A base-class pointer can point to a derived
class object. (The reverse is an error).
By creating a vector of pointers, we can hold a
collection of both base-class and derived-class objects.
vector<Clock*> clocks(3);
/* populate clocks */
clocks[0] = new Clock(true);
clocks[1] = new TravelClock(true, "Rome", 9);
clocks[2] = new TravelClock(false, "Tokyo", -7);
Pointers to the various clock objects all have
the same size - the size of a memory address - even though the
objects themselves may have different sizes.
Since every TravelClock is a special
case of a Clock, the starting address of a
TravelClock object is the starting address of a
Clock object.