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.


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

Get C# 5.0 Unleashed now with O’Reilly online learning.

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