Protected member: – A C++ not only support the access specifier private and public, but also an important access specifier protected, which is significant in class inheritance. As for as the access limit is conserved, with in a class or rom the object of a class, protected access limit is same as that of private specifier. However, the protected specifier has a prominent role to play an inheritance.

In inheritance all the three class specifier such as private, protected and public can be use but they must be assign in a proper sequence such as private member can be use first followed by protected and finally public member section can be used. A private member visible to member function within its on class but not in derived class. Protected member visible to member function within its class as well as in derived class. Public section is visible to member with in its class, derived class and through object.

Advertisements