Close sidebar

Accessing private and protected members

How can we access protected and private members of a class in C++?

Your Answer

you can access the private members within the class only. private members are hidden from the other classes. and Protected members are only accessible by that class as well as its subclasses only. and public members are accessible by all the classes.

टिप्पणी
मॉक परीक्षण अभ्यास के लिए
c plus plus programming