It is up to whome has implemented this base class. The programmer who implements a inherited class usualy do not know what to initialize, which variable to change and many details. He know only some properties of it.
This mecanisme assure what the base class will be properly initialized. John Fill
The responsibility for creating an object of a class is
with the class's constructor. If you dont know, C++ compilers always create a default constructor if the programmer doesnt specify one in his declaration.
Declaring a constructor as 'virtual' violates the integrity of a class, since the derived class can then make changes in
the way the base class is constructed. Hence it is never
allowed.
In short, constructors are never virtual to make sure base classes are properly created(constructed). On the other hand destructors can be virtual or pure virtual.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.