I would know the difference between friend class and inhertnce class?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

I would know the difference between friend class and inhertnce class??

16th Dec 2017, 9:51 AM
^_^
^_^ - avatar
2 Answers
+ 2
They really have nothing to do with one another. Inheritance means that all instances of child class are also instances of superclass. The friend keyword makes private members accessible to the friend.
16th Dec 2017, 10:11 AM
1of3
1of3 - avatar
+ 1
structure has no inhertance relativity. inhertance represetived in cpp by: - class, has (three access control layers): - public - private - protected however, friend is a property which would be could be added to another class. so, the second class with friend prevelge has a full access to the first class's content even if the first class has an access control layers
1st Feb 2018, 8:34 AM
Bkeefk