O'Reilly logo

C# 5.0 Unleashed by Bart De Smet

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

Single Inheritance for Classes

The CLR, the C# programming language, as well as other Common Language Infrastructure (CLI) languages support only single inheritance for classes. In other words, only a single base class can be used for any given class. When omitted, that base class is System.Object. In the example shown in Figure 14.6, we try to declare a class Tomato, which is both a Fruit and a Vegetable.

Image

FIGURE 14.6 No multiple-class inheritance allowed.

Note: The Diamond Problem

One of the main reasons for not supporting multiple-class inheritance in the CLR comes from the well-known problems and complexities that arise from multiple inheritance, ...

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