Working with Multiple Interfaces Visual C Sharp 2010

Working with Multiple Interfaces Visual C Sharp 2010

A class can have at most one base class, but it is allowed to implement an unlimited number of interfaces . A class must still implement all the methods it inherits from all its interfaces . If an interface, structure, or class inherits from more than one interface, you write the interfaces in a comma-separated list . If a class also has a base class, the interfaces are listed after the base class . For example, suppose you define another interface named IGrazable that contains the ChewGrass method for all grazing animals . You can define the Horse class like this:


class Horse : Mammal, ILandBound, IGrazable 

    ... 
}

No comments:

Post a Comment