Tuesday, July 05, 2005

Interface Rules

1) All method declarations are public within an interface. This is the default access modifier, which means you can omit the modifier in the declaration. As a matter of fact, if you code a modifier like protected, private, or even public, you will get a compiler error.
2)
An interface cannot contain data declarations. However, you can declare properties:int amountOfFood
{
get;
set;
}
3)
An interface can inherit from another interface. You may wish to add more functionality to the interface and keep the original less-specific interface as it is
interface ISnakeFeedable: IFeedable
{
void FeedSnake();
}

0 Comments:

Post a Comment

<< Home