0
what is the concept of interface? and what is use of it?
please give me with examples
2 Answers
+ 1
It's some kind of contract. Interface includes methods signatures and force classes implementing this interface to implement all methods which are declared in the interface.
+ 1
interface ICreature
{
    void speak();
    void drink();
    bool isAlive();
}
public class Human : ICreature
{
    public void speak()
    {
        //implementation
    }
    public void drink()
    {
        //implementation
    }
    public bool isAlive()
    {
        //implementation
    }
}



