If the class members are private then is it still accessible to derived class? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

If the class members are private then is it still accessible to derived class?

14th Sep 2016, 10:50 PM
Arif
7 Answers
+ 9
No, private makes it inaccessible by other classes as well as derived classes. This is why we use protected, so other classes except for derived classes can't access it.
29th Sep 2016, 10:11 AM
Crook
Crook - avatar
+ 7
No,because private members of a class are accessible only within the class no outside of the class
7th Oct 2016, 3:59 AM
Vishwanath Patil
Vishwanath Patil - avatar
+ 4
You can only there with PUBLIC
4th Dec 2016, 11:11 PM
Burhan Ilhan
Burhan Ilhan - avatar
+ 4
no we can't access the member if you are using private access specifiers ie they are bounded to that particular class only
9th Feb 2017, 5:34 PM
Vishnudas
Vishnudas - avatar
0
exactly
17th Sep 2016, 6:49 PM
Fabricio Bertani
Fabricio Bertani - avatar
0
No
10th Apr 2018, 2:26 AM
welcomhack
welcomhack - avatar
0
No, but in you want to use members also in a derived class use the access modifier protected.
11th Apr 2018, 11:45 PM
Hergen