Last active
December 17, 2017 15:58
-
-
Save kmkrn/c344256f4c13b310df2c4bb09568ca78 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol DogBreed { | |
typealias Level = Int | |
var breedName: String { get set } | |
var size: Level { get set } | |
var health: Level { get set } | |
var adaptability: Level { get set } | |
var intelligence: Level { get set } | |
var dogType: DogType { get set } | |
} | |
enum DogType: String { | |
case companion = "companion" | |
case sled = "sled dog" | |
} | |
class SiberianHusky: DogBreed { | |
var breedName: String | |
var size: Level | |
var health: Level | |
var adaptability: Level | |
var intelligence: Level | |
var dogType: DogType | |
init() { | |
self.breedName = "Husky" | |
self.size = 3 | |
self.health = 4 | |
self.adaptability = 3 | |
self.intelligence = 3 | |
self.dogType = .sled | |
} | |
} | |
class Pomsky: SiberianHusky { | |
override init() { | |
super.init() | |
self.breedName = "Pomsky" | |
self.size = 2 | |
self.dogType = .companion | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment