In C ++, I have class A that is a friend with Class B.
I think B's heritage classes are not friends of Class A.
Is this a C ++ or a limit to my mistake?
Here's an example. While compiling, I get an error on "Return New Memento":
Memento :: Memento: It is impossible to use a private member declared in Memento.
class origin; Class memento {Buddy class origin; Memento() {}; Int M_data; Public: ~ Memento () {}; }; Class Genre {Public: Virtual Memories * BuildMemento () = 0; }; Category FooOriginator: Public Creators {Public: Memento * CreationMemento () {New Memento; // It is impossible to use private member of Memento}}; Zero main () {FooOriginator MyOriginator; MyOriginator.createMemento (); }
I can definitely add FooOriginator as friend of Memento, but then, that means that I have to add all Genesis-heritage classes as Friends of Memento To avoid that which I like.
Any thoughts?
View:
Exact Duplicate Marked.
I think the successor class of B is not a member of class A.
Correct
I C ++ or the limit of my fault?
This C ++ works I do not see it as a limit.
Comments
Post a Comment