An interface is a contract. If you are defining an interface, then you are describing a set of rules. A class can follow the rules specified by the interface. When a class fulfills the contract or rules specified by the interface, we could say that a class implements the interface.
Interfaces in C# provide
a way to achieve runtime polymorphism. Using interfaces we can invoke
functions from different classes through the same interface
reference, whereas using virtual functions we can invoke functions
from different classes in the same inheritance hierarchy through the
same reference.
Public interface
<interface name>
{
//specify the contract
}
An interface looks like a
class, but has no implementation. The only thing it contains are
declarations of events, indexers, methods, and /or properties. The
reason interfaces only provide declarations is that they are
inherited by classes and structs, which must provide an
implementation for each interface member declared.
If you are interested to
learn more OOPS concepts and their application in .NET, you can join
SLA IT Employment Training Company. For
more details visit SLA Jobs T Nagar Chennai
or dial (91
44) 4200 5050/90.