About this pointer although this pointer is already very familiar, I discussed the question of this pointer here may haven't been noticed: In order to illustrate this property of this, I have self-written a simpler program, though Simple but specific: #include
About the polymorphism and virtual function summarize as follows: 1) Pointer: The parent class can point to the subclass object, but can only call itself, the member function and the member variable, except for the virtual function; the pointer of the subclass can only point to the parent class The display type is converted into a subclass of objects, calling the sub-class itself, and the variable is except for the virtual function. 2) No pointer (type conversion between objects): The parent class object can be converted into a subclass object, and only its own functions and variables can not call the function and members of the subclass, regardless of the virtual function; The object cannot be displayed to the parent class object unless the person is written related code.
That is: The virtual function must be used with the pointer; except for the virtual function, the type conversion between the inheritance class has no direct effect.
Object survival
Four: Stack, Heap, Global, Local Static Production Method: First: In the function, main () is second: New method third: outside of any function range, initialization by startup code . The fourth: static objects within the range of functions