How can we access private mode inheritance i.e. class B: private A | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How can we access private mode inheritance i.e. class B: private A

22nd Jan 2018, 2:01 PM
Sagar Pipaliya
Sagar Pipaliya - avatar
3 Answers
+ 6
Class B: private A{}; will make the public,protected data and members of class A... private to class B i.e class A { public: int a; void welcome(){cout<<"hi";} }; class B : private A{}; means class B{ private: int a; void welcome(){cout<<"hi";} }; use Friend Functions!!
29th Jan 2018, 2:12 PM
I'm_Groot
I'm_Groot - avatar
+ 2
http://www.cplusplus.com/forum/beginner/12899/ Don't worry, I don't think I understand it either.
22nd Jan 2018, 2:19 PM
BlazingMagpie
BlazingMagpie - avatar
+ 1
objects a
22nd Jan 2018, 2:43 PM
Rahul Yadav
Rahul Yadav - avatar