What problems you find with inheritance? Is multiple inheritance supported in C#?
- Inheritance is one of the characteristic features of Object Oriented Programming languages.
- Inheritance provides extension of a base functionality of a parent class by its child classes or derived classes.
- Although inheritance improves code-reuse and extension, overusing it might add to code complexity and make code less readable.
- There are different types of inheritance possible:
- Simple - One parent, One Child
- Multi-level - a chain of parent-child classes
- Tree - One parent, multiple child
- Multiple - multiple parents, one child
- C# support all three inheritances while it doesn't support multiple inheritance. In C# you can extend only one concrete parent class, while you can implement more than one interfaces.
Object Oriented Programming Concepts - Inheritance
Posted May 14, 2021