- C# 7 and .NET Core Cookbook
- Dirk Strauss
- 121字
- 2021-07-03 00:11:58
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.
推薦閱讀
- Android Wearable Programming
- GraphQL學(xué)習(xí)指南
- 機(jī)器學(xué)習(xí)系統(tǒng):設(shè)計(jì)和實(shí)現(xiàn)
- Cassandra Data Modeling and Analysis
- Quarkus實(shí)踐指南:構(gòu)建新一代的Kubernetes原生Java微服務(wù)
- 計(jì)算機(jī)應(yīng)用基礎(chǔ)實(shí)踐教程
- Creating Data Stories with Tableau Public
- Clojure for Java Developers
- Vue.js 3應(yīng)用開發(fā)與核心源碼解析
- Scala Functional Programming Patterns
- Visual C++程序設(shè)計(jì)與項(xiàng)目實(shí)踐
- Java并發(fā)實(shí)現(xiàn)原理:JDK源碼剖析
- Tableau Dashboard Cookbook
- Mastering OpenStack
- 算法訓(xùn)練營:海量圖解+競賽刷題(入門篇)