- Hands-On Design Patterns with Kotlin
- Alexey Soshin
- 61字
- 2021-06-25 20:49:29
Abstract Factory in action
Our strategy game will consist of buildings and units. Let's start with declaring what all buildings share:
interface Building<in UnitType, out ProducedUnit>
where UnitType : Enum<*>, ProducedUnit : Unit {
fun build(type: UnitType) : ProducedUnit
}
All buildings should implement the build() function. Here we see generics in Kotlin for the first time, so let's discuss them a bit.
推薦閱讀
- OpenStack Cloud Computing Cookbook(Third Edition)
- SoapUI Cookbook
- LabVIEW2018中文版 虛擬儀器程序設計自學手冊
- Building a RESTful Web Service with Spring
- HoloLens Beginner's Guide
- Learning Informatica PowerCenter 10.x(Second Edition)
- Easy Web Development with WaveMaker
- AutoCAD VBA參數化繪圖程序開發與實戰編碼
- 青少年Python編程入門
- HTML5入門經典
- Java 9模塊化開發:核心原則與實踐
- SSM開發實戰教程(Spring+Spring MVC+MyBatis)
- AI自動化測試:技術原理、平臺搭建與工程實踐
- Microsoft Windows Identity Foundation Cookbook
- Laravel 5.x Cookbook