O'Reilly logo

C# Primer Plus by Klaus Michelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required