C# FAQ: Does CSharp have multiple inheritance like Cplusplus
Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio
| CSharp-Online.NET:FAQs |
| edit |
[edit]
Does C# have multiple inheritance like C++ ?
No. C# does not have C++ style multiple inheritance. But, like the Java language, C#—and .NET languages generally—has multiple interface inheritance. An interface is similar to a pure abstract class. This means that a type can implement multiple interfaces but can only inherit a single implementation. So, a class can be derived from only one other class. That class, in turn, may inherit from another single class.
The reason for this is that multiple inheritance is difficult for developers to implement and debug efficiently. Multiple inheritance can lead to a host of diabolical situations which are difficult to diagnose and repair.
[edit]
See also
- Implement .NET Framework interfaces
- Implementing Interfaces
- Interface
- Interface-Based Programming
- Should I use an abstract class or an interface?
- Test for an interface implementation
- Using Inheritance Effectively
- Visual Studio: Implementing interfaces