- 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.
推薦閱讀
- Learning Spring 5.0
- 青少年美育趣味課堂:XMind思維導圖制作
- Django Design Patterns and Best Practices
- 精通API架構:設計、運維與演進
- PHP 編程從入門到實踐
- Visual C++開發入行真功夫
- 機器學習微積分一本通(Python版)
- 軟件工程與UML案例解析(第三版)
- Learning Unreal Engine Game Development
- Microsoft HoloLens By Example
- WCF技術剖析(卷1)
- INSTANT Premium Drupal Themes
- Python應用開發技術
- RESTful Web API Design with Node.js
- Getting Started with RethinkDB