Derived access specifier

An access specifier (public, protected, private) type

1, class member access specifier

public: class of users can access

protected: within the class and friends can access, the user can not access the class

private: only within the class can access, you can interact with the outside world through a public interface and class

2, derived access specifier

3. Access Description

 Visitors will be divided into four classes

1, the base class implementor, i.e., the base class access

All members of the base class (public, protected, private) can access

2, the user base class, the base class object that is accessed by

Access only public members of the base class

The access class 3, subclass implementor, i.e., subclass

All members of the class to inherit from the child's (following the public and protected members of Chengzi Ji class members, according to instructions inherit access rights of different characters in different sub-classes, specific see table above) are accessible,

Of course, private members of the base class is a subclass of invisible, naturally, can not access

4, the user subclass, i.e., subclass object accessed by

 Only members of the public to access subclasses

Guess you like

Origin www.cnblogs.com/hustsss/p/11242613.html