The access visibility of the members between the parent class and the subclass in the resolution class inheritance: external visibility: refers to the external access control of the parent class members inherited by the quilt class in the subclass, there are protected, public, and private. Internal visibility: it refers to the internal access control of the parent class members inherited by the quilt class in the method defined by the subclass, including accessible (Y) and inaccessible (N ). Class A {private: void pvA (); protected: void ptA () public: void pbA ();....} class B: public A {void func () {pvA (); // error ptA (); // OK pbA (); // OK }....} void g (B & B) {B. pvA (); // error B. ptA (); // error B. pbA (); // OK} class B: protected A {void func () {pvA (); // error ptA (); // OK pbA (); // OK }....} void g (B & B) {B. pvA (); // error B. ptA (); // error B. pbA (); // error} class B: private A {void fu Nc () {pvA (); // error ptA (); // OK pbA (); // OK }....} void g (B & B) {B. pvA (); // error B. ptA (); // error B. pbA (); // error} 2. What happens when a virtual method is called in the constructor of the class? If a virtual method is called in the constructor, a running error occurs. The reason is: when the constructor of the parent class is called, the constructor of the Child class is not called yet, but the constructor of the parent class calls the virtual method, according to the implementation mechanism of the virtual method, the virtual method called by the parent class is defined in the subclass, that is, the virtual function called during this period is reduced to the subclass class, the subclass function uses the member variables of the subclass. At this time, the member variables of the subclass are not initialized, which means that a method of the type object that has not been constructed is called, therefore, a call error occurs. By the way, when a type is constructed, the construction order is: first execute the initialization expression of the member variable and then execute the constructor of the parent class, finally, call your own constructor. 3. Allocation of reference types in memory: first, allocate a reference object on the stack, allocate an object instance on the stack, and then point the referenced object on the stack to the object instance on the stack. Example: class person {private: char * name; int age; public: person (char * s, int n): name (s), age (n) {}....} person a = new person ("Tom", 24); person B = a; // design to copy in Depth