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

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.

主站蜘蛛池模板: 无棣县| 安乡县| 麻城市| 平邑县| 曲靖市| 浮山县| 筠连县| 安义县| 丹棱县| 宝坻区| 广州市| 共和县| 巴彦淖尔市| 股票| 邯郸县| 封丘县| 贵港市| 蒙阴县| 慈溪市| 枣阳市| 略阳县| 澎湖县| 广河县| 高清| 岗巴县| 嘉峪关市| 平定县| 衡南县| 周宁县| 巴青县| 诸暨市| 云浮市| 平江县| 利川市| 齐河县| 灵寿县| 简阳市| 原平市| 罗田县| 西昌市| 广河县|