#752 – C# Does Not Support Multiple Inheritance

Some other object-oriented languages, like C++ and Python, support multiple inheritance.  Multiple inheritance allows a class to inherit data and behavior from more than one parent class.

C#, on the other hand, does not support multiple inheritance.  Every class inherits from exactly one class.  Multiple inheritance can lead to certain problems in object-oriented languages.  (E.g. the “diamond problem“).  C# avoids these problems by supporting only single inheritance.

While a class in C# can only inherit from a single base class, it can implement a number of different interfaces.


About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

One Response to #752 – C# Does Not Support Multiple Inheritance

  1. Mason says:

    Default method implementations in interfaces (C# 8.0) effectively allow multiple inheritance of behavior without introducing the diamond problem, as you have to cast the object to the appropriate interface in order to execute any such default method implementation.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: