Implementation inheritance and interface inheritance - C#.NET

What are implementation inheritance and interface inheritance?

Implementation inheritance:

- It is achieved when a class is derived from another class in such a way that it inherits all its members.
- It is called as Class Inheritance.
- In this, it uses 'extends' keyword in Java.
- It uses 'IS A' relationship.
- The subclass is tightly coupled with superclass.
- If there is any changes to superclass will break the whole relationship.

Interface inheritance:

- It is achieved when a class inherits only the signatures of the functions from another class.
- It is called as Type inheritance and also called as subtyping.
- In this, it uses 'implements' keyword in Java.
- It is used for code reuse and polymorphism.
- It uses 'HAS A' relationship, there is no IS A relationship.
- It reduces coupling and implementation dependencies.
How to add a ReadOnly property in C#.NET
How to add a ReadOnly property in C#.NET? - Properties can be made read-only by having only a get accessor in the implementation...
How to prevent a class from being inherited in C#.NET
How to prevent a class from being inherited in C#.NET? - The sealed modifier is used to prevent derivation from a class...
What are generics in C#.NET?
What are generics in C#.NET? - Generic types to maximize code reuse, type safety, and performance....
Post your comment