Virtual Methods

What Are They?

Virtual methods allow inherited methods of classes to be overwritten, even when a pointer to the base class is used. You can overwrite methods without using the virtual descriptor, just by using the same name, but the overwritten methods will not be called when a pointer to the base class is used. Real virtual methods are virtual methods that require implementation by a derived class.

What Does It Mean For The Class?

Any class which has real virtual methods is considered “not a real class” and are called abstract classes, and you cannot create objects of these classes, only inherited classes which “fill in” the real virtual methods.

Are The Derived Methods Virtual Too?

Yes. If the base method is declared virtual, then all derived overloads for the method are virtual also.