< Previous | Contents | Next >
In this chapter, you should have learned the following concepts:
n One of the key elements of OOP is inheritance, which allows you to derive a new class from an existing one. The new class automatically inherits data members and member functions from the existing class.
n A derived class does not inherit constructors, copy constructors, destruc- tors, or an overloaded assignment operator.
n Base class constructors are automatically called before the derived class constructor when a derived class object is instantiated.
n Base class destructors are automatically called after the derived class destructor when a derived class object is destroyed.
n Protected members are accessible only in their own class and certain derived classes, depending upon the derivation access level.
n Using public derivation means that public members in the base class become public members in the derived class, protected members in the base class become protected members in the derived class, and private members are (as always) inaccessible.
n You can override base class member functions by giving them new defi- nitions in a derived class.
n You can explicitly call a base class member function from a derived class.
380 Chapter 10 n Inheritance and Polymorphism: Blackjack
n You can explicitly call the base class constructor from a derived class instructor.
n Polymorphism is the quality whereby a member function will produce different results depending on the type of object for which it is called.
n Virtual functions allow for polymorphic behavior.
n Once a member function is defined as virtual, it’s virtual in any derived class.
n A pure virtual function is a function to which you don’t need to give a definition. You specify a pure virtual function by placing an equal sign and a zero at the end of the function header.
n An abstract class has at least one pure virtual member function.
n An abstract class can’t be used to instantiate an object.