Friendship and nested classes

J

Juha Nieminen

Assume we have this kind of class hierarchy:

class A
{
class B;
};

class C
{
friend A;
};

Can B access the privates of C? What are the rules of friendship scope?
 
M

Martin York

  Assume we have this kind of class hierarchy:

class A
{
    class B;

};

class C
{
    friend A;

};

  Can B access the privates of C? What are the rules of friendship scope?

No.

Just because you are my friend: (And I let you drive my car)

* I don't necessarily trust your kids. (Especially with my car)
* I don't necessarily trust your friends.(Especially with my car)
* You don't need to trust me. (With your Ferrari)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,163
Latest member
Sasha15427
Top