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

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.

主站蜘蛛池模板: 株洲市| 深泽县| 承德市| 青海省| 类乌齐县| 万宁市| 侯马市| 长岛县| 湖口县| 大荔县| 明光市| 色达县| 玉龙| 辉南县| 崇阳县| 巫山县| 临夏市| 白河县| 龙胜| 新和县| 长治市| 土默特右旗| 固始县| 稷山县| 黔南| 高平市| 旅游| 靖边县| 镇坪县| 万宁市| 抚松县| 大荔县| 宁明县| 富阳市| 卓尼县| 贵溪市| 且末县| 东阳市| 公主岭市| 平安县| 郧西县|