danijar danijar - 3 months ago 10
C++ Question

What is the difference between protected and private?


Possible Duplicate:

Private and Protected Members : C++




I don't understand the difference between protected and private members or methods, as I assumed both will hide the member or the function to access from outside the class.

What is the difference between the protected and the private keywords?

Answer

private - only available to be accessed within the class that defines them.

protected - accessible in the class that defines them and in other classes which inherit from that class.