|
-
July 11th, 2010, 03:11 AM
#1
Friend declarations: nested classes and base-clauses
Hi there!
I've got two questions about friend declarations.
1)
According to the 11.8.1 paragraph of C++03 standard:
The members of a nested class have no special access to members of an enclosing class, nor to classes or functions that have granted friendship to an enclosing class
How is it possible that a single function can grant friendship to a class ?
2)
My second question concerns a base-clause of a nested class.
We can read in C++0x standard draft (11.4.2 paragraph) that:
Declaring a class to be a friend implies that the names of private and protected members from the class granting friendship can be accessed in the base-specifiers and member declarations of the befriended class.
[ Example:
Code:
class A
{
class B { };
friend class X;
};
struct X : A::B //OK: A::B accessible to friend
{
A::B mx; //OK: A::B accessible to member of friend
class Y
{
A::B my; //OK: A::B accessible to nested member of friend
};
};
—end example ]
It isn't mentioned in the example whether private and protected type names from the class granting friendship can be used in the base-clause of a nested class of the friend class (here it would be the base-clause of class Y).
I think they can, do you think so too ?
I can't check it by myself since I don't have any compatible with C++0x compilers...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|