Summary
  • A base class pointer can point to derived class object.
  • In general4, a derived class pointer cannot point to base class.
  • Abstract base class is a base class. The name implies that it cannot be used for declaring objects. It contains at least one pure virtual function. That is the reason, why it becomes abstract.
  • When deriving a class from abstract base class, all pure virtual functions must be completely defined. Otherwise, such class cannot be instantiated.
  • C++ allows base class pointer to point to derived class objects. In this case, base class methods are executed instead of derived class methods. If base class method is declared virtual, function in the derived class is executed.
  • Polymorphism means the ability of objects of different ...

Get Object Oriented Programming with C++, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.