In response to an error about vtable: the virtual command in this case tells C ++ to create a virtual method table in the base class. Thus, when you use polymorphism, C ++ can replace the virtual methods of the base class with methods from the derived class with the same name at run time. This error tells the user that this replacement is not possible. To fix this error, you need to either implement this method or install it as a pure virtual one, adding "= 0" at the end of the definition.
In response to the changes: the reason you don't get an error when creating an object as a base class is because the base class does not need access to the virtual table. On the other hand, if you are really trying to use this method, you should get an error message because no implementation exists. In other words, even if you can create an object of a base class, it is not a complete class.
Zachary kraus
source share