Difference Between Implementation Inheritance and Interface Inheritance
Implementation Inheritance vs Interface Inheritance
Both Implementation Inheritance and Interface Inheritance are types of inheritance. Inheritance is the concept of Object Oriented Programming (OOPs). Inheritance is used for code reuse. Check out the Differences between Implementation Inheritance and Interface Inheritance.
- Implementation Inheritance is called Class Inheritance.
- Implementation Inheritance is achieved in Java by using the extends keyword.
- Implementation Inheritance should be used only when the subclass IS A superclass (relationship).
- In this inheritance, the subclass is tightly coupled with superclass.
- Any changes to superclass will break the whole relationship. Make sure that the subclasses depend only on the behaviour of the superclass, not on the actual implementation.
- Interface Inheritance is called Type Inheritance also called as subtyping.
- Interface Inheritance is achieved in Java by using the implements keyword and Object Composition (HAS A relationship).
- Interface Inheritance is used for Code reuse and polymorphism and there is no IS A relationship.
- Interface inheritance reduces coupling and implementation dependencies. You can use inheretance between unrelated classes but has set of common methods.
- Interface inheritance promotes the design concept of program to interfaces not to implementations.
These are the Difference between Implementation Inheritance and Interface Inheritance, If you know more differences, Do contribute by leaving the comment. I will be happy to add them in this post.
Posted under: Programming
1957 readers are already subscribed to this blog! Why don't you be one of them? Subscribe to this blog via your favorite RSS feed reader or by entering your email address on the form below: