Interface Homework Help
It is similar with the classes in OOP which have some variables, methods and these methods are by default abstract means it is signature of method without the implementation of this method.
Interface should be declare with using of keyword interface. To provide abstraction totally.
The field of these interface are static, public and final by default.
To implement the above describe interface we used the implementation keyword with interface name. Following are the interface use:
- If we have to abstract the class totally we used interface
- Used to avoid the loose coupling
- Abstract implementation
- Used to define variables which are non-static whereas interfaces have static variables in their body.
Let suppose a function an object has functionality which is different from other objects but the type of these objects are similar so we can use interface and implement their required functionality.