interface
In this chapter you will learn:
What is interface
An interface defines a series of members the implementer must implement and an interface itself doesn't provide any implementation. A class can implement any number of interfaces. A struct can implement interface as well. An interface can only have methods, properties, events and indexers.
Interfaces are declared by using the interface keyword. Here is a simplified form of an interface declaration:
interface name {/*j ava 2s . c o m*/
ret-type method-name1(param-list);
ret-type method-name2(param-list);
// ...
ret-type method-nameN(param-list);
}
The following code defines an interface Printable
.
interface Printable{
void Print();
}
Next chapter...
What you will learn in the next chapter:
- How to implement an interface
- Code to show how to create and implement interface
- Multiple Implementation: implement two interfaces
- extend class and implement interface at the same time
Home » C# Tutorial » Class