June 2018
Intermediate to advanced
310 pages
6h 32m
English
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.
Read now
Unlock full access