Multiple Inheritance and Interface Implementation

Some programming languages allow multiple inheritance, where a class can inherit from more than one parent class. For example, suppose that you have a Domicile class and a Vehicle class. You might want a HouseBoat class or a MotorHome class to inherit from both those classes.

Unfortunately neither Visual Basic nor C# allows multiple inheritance. In fact, most object-oriented languages support only single inheritance. You can, however, gain some of the benefits of inheritance from multiple parent classes by using interfaces and composition.

In Visual Basic and C#, you can define an interface. An interface defines a set of members that a class can provide. A class that implements the interface must ...

Get Start Here!™ Fundamentals of Microsoft® .NET Programming now with O’Reilly online learning.

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