When you construct a derived class object, first run the base class constructor to initialize the base classes section of the object. When you execute a base class constructor, the derived class part of the object is uninitialized. In fact, the object is not yet a derived class object at this time.
When you revoke a derived class object, it first revokes its derived class part, and then revokes its base class part in reverse order of construction.
In both cases, the object is incomplete when the constructor or destructor is run. To accommodate this incomplete, the compiler treats the type of the object as if it had changed during construction or destruction. In a base class constructor or destructor, the derived class object is treated as a base class type object.
Object types during construction or destruction have an effect on the binding of virtual functions.
If a virtual function is called in a constructor or destructor, the version defined for the constructor or destructor itself type is run.
This binding is applied whether the virtual function is called directly by a constructor (or destructor), or if a virtual function is called indirectly from a function called by a constructor (or destructor).
To understand this behavior, consider what happens if you call a derived class version of a virtual function from a base class constructor (or destructor). The derived class version of a virtual function is likely to access the members of the derived class object, after all, if the derived class version does not need to use the members of the derived class object, the derived class will probably be able to use the definition in the base class. However, the members of the derived part of the object are not initialized during the base class constructor run, and in fact, if such access is allowed, the program is likely to crash.
Virtual functions in constructors and destructors