Multiple Levels of Derived Classes

It is possible to use a derived class as a base class for another derived class. In other words, you can create as many levels of derived classes as you want. For example, you could create a general TransportationVehicle class in line with Figure 16.1 and, from this class, derive a SurfaceVehicle class. This again could be a base class for a Car class that finally could become the base class for our well-known SportsCar, FamilyCar, and RacingCar classes, as illustrated in Figure 16.9.

Figure 16.9. Multiple levels of inheritance.

Listing 16.8 demonstrates how a part of Figure 16.9 can be implemented by implementing ...

Get C# Primer Plus now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.