In what sense can the interface to a class be considered a contract? What are the repercussions of this for subtyping relations?
Solution:
The idea is that any class which is implementing an interface must implement all its methods in it which means an interface is a contract which states to implement the methods present in the classes to be implemented.
The repercussions are that whatever methods are defined in an interface must be implemented in the class which is going to implement the interface. This ensures the benefits of multiple inheritances.
Hit the thumbs up if you liked the answer. :)
Get Answers For Free
Most questions answered within 1 hours.