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

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.

主站蜘蛛池模板: 喀喇| 全椒县| 泊头市| 东阿县| 红河县| 凤冈县| 自贡市| 沅陵县| 富平县| 年辖:市辖区| 陵水| 镇赉县| 夏邑县| 阿拉尔市| 凤台县| 泰宁县| 齐齐哈尔市| 清河县| 建平县| 元氏县| 师宗县| 白银市| 晴隆县| 车险| 凤庆县| 三明市| 桐城市| 萨迦县| 海门市| 张掖市| 同心县| 定兴县| 永胜县| 山丹县| 临武县| 宜阳县| 南川市| 彰武县| 交城县| 汾西县| 广州市|