Multiple Inheritance
noun
say it: “MUL-tih-pul in-HAIR-ih-tuns” /ˈmʌltɪpəl ɪnˈhɛrɪtəns/
Inheriting from two or more base classes at once, which C# doesn't allow; it uses interfaces instead.
What is Multiple Inheritance in C#?
Multiple Inheritance — A class inheriting from two or more base classes at once. C# allows only one base class, so a class that needs several abilities inherits from one class and implements as many interfaces as it needs.
class Duck : Animal, IFlyable, ISwimmable { /* ... */ } // one base class, two interfaces
// class Duck : Animal, Bird { } // error: only one base class allowed
In a sentence
- “C# has no multiple inheritance, so Duck inherits from Animal and implements IFlyable.”
Level: Journeyman · More C# terms at this level
Updated