What is the difference between declaring two classes as friend and allowing a class to inherit privately from another class? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

What is the difference between declaring two classes as friend and allowing a class to inherit privately from another class?

11th Nov 2016, 4:05 PM
User3827
2 Answers
+ 2
Inherit from another class avoid Code redundency and you can use the Variables and Atrributes from the class you derive from. When you declare two identical Classes seperately, so you will probably all Variables and Attributes declared exact the same way. That produces unnecessary Code,Time and Memory.
11th Nov 2016, 8:57 PM
Denis Vejzagic
Denis Vejzagic - avatar
0
how can add other language in weapon challenge
11th Nov 2016, 8:57 PM
Mohammad Bilal
Mohammad Bilal - avatar