What is the difference between Private and Protected in C++??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

What is the difference between Private and Protected in C++???

30th Dec 2016, 4:25 PM
Pravin
Pravin - avatar
2 Answers
+ 5
protected members can be accesed by its derivative classes but private can not.
30th Dec 2016, 4:40 PM
Sandeep Chatterjee
+ 2
Private members are accessible by only the members of same class but protected can be accessed in inherited classes and both can not be accessed outside the class
31st Dec 2016, 7:51 AM
Raj Kumar