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

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.

主站蜘蛛池模板: 小金县| 汤原县| 松潘县| 垣曲县| 绥芬河市| 太仓市| 寿宁县| 延津县| 福贡县| 赣榆县| 莒南县| 宜章县| 台中市| 视频| 崇阳县| 平陆县| 泰来县| 綦江县| 敦化市| 施秉县| 缙云县| 青龙| 汨罗市| 嘉善县| 兴化市| 攀枝花市| 阜城县| 迁安市| 渑池县| 民丰县| 南投县| 漯河市| 繁昌县| 桃江县| 永泰县| 麻城市| 甘德县| 马鞍山市| 宜君县| 海晏县| 建平县|