官术网_书友最值得收藏!

Creating and implementing an interface

For many developers, interfaces are equally confusing and their purpose not clearly understood. Interfaces are actually quite easy to get to grips with once you understand the concept that defines an interface.

Interfaces act like verbs. So, for example, if we had to create two classes called Lion and Tiger that derive from the Cat abstract class, the interface would describe some sort of action. Lions and tigers can roar (but not purr). We can then create an interface called IRoarable. If we had to derive a class called Cheetah from our abstract class Cat, we would not be able to use the IRoarable interface, because cheetahs purr. We would need to create an IPurrable interface.

主站蜘蛛池模板: 日喀则市| 庄浪县| 温泉县| 乐安县| 南充市| 荣成市| 德惠市| 北京市| 怀来县| 沾益县| 分宜县| 孝义市| 巫溪县| 巴林右旗| 玛纳斯县| 颍上县| 康定县| 公主岭市| 五家渠市| 昌邑市| 囊谦县| 夏邑县| 石屏县| 昌黎县| 广水市| 泰来县| 滁州市| 枝江市| 临夏县| 塔河县| 遂宁市| 华坪县| 平谷区| 家居| 冀州市| 泰顺县| 五台县| 漠河县| 滦平县| 和田市| 晴隆县|