An Interface is an abstract class which has only public abstract methods, and the methods only have the declaration and not the definition. These abstract methods must be implemented in the inherited classes.
There are few properties of the interface class,
Interfaces specify what a class must do and not how.
Interfaces can’t have private members.
By default, all the members of Interface are public and abstract.
The interface will always be defined with the help of the keyword ‘interface‘.
An interface cannot contain fields because they represent a particular implementation of data.
Multiple inheritances are possible with the help of Interfaces but not with classes.
An Interface is an abstract class which has only public abstract methods, and the methods only have the declaration and not the definition. These abstract methods must be implemented in the inherited classes.
There are few properties of the interface class,
Syntax for Interface Declaration:
Syntax for Implementing Interface:
Sample Example Code,
need an explanation for this answer? contact us directly to get an explanation for this answer