I have question that bothers me for few days.
Abstract class is a special type of class that we cannot instantiate, right?. (Which is denoted/specified by giving a “= 0” to at least one method declaration, which looks like an afterthought).
What are the extra benefits that the abstract class mechanism brings to C++, that a ‘normal’ base class cannot achieve?
According to the wikibooks section on abstract classes:
As mentioned, it’s a way of defining an interface to which derived classes must adhere. Their example of the
Vehicleabstract class is very apropos: you’d never have just aVehiclein real life, you’d have a Ford Explorer or a Toyota Prius, but those both conform to (for the sake of argument) a base set of functionality that being aVehiclemight define. But, you can’t just go to theVehicledealership and drive aVehicleoff the lot. Thus, you’d never want to be able to construct and use a baseVehicleobject where you’d really want a specialized, derived object.