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();
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s