Why declaring a constructor as virtual is meaningless .
When you call the constructor, the virtual table will not be available in memory. Declaring something virtual in C ++ means that it can be overridden by a subclass of the current class, however, the constructor is called when creating the object object, while you cannot create a subclass of the class, which should be creating the class, so there will never be a need declare the constructor virtual. Therefore, in C ++ there is no such thing as a virtual constructor .
What happens when I call a virtual function from a constructor? Is the virtual table used too
See the C ++ FAQ link for a detailed explanation of this issue.
taocp source share