Skip to content

Instantly share code, notes, and snippets.

@kmkrn
Last active December 17, 2017 15:58
Show Gist options
  • Save kmkrn/c344256f4c13b310df2c4bb09568ca78 to your computer and use it in GitHub Desktop.
Save kmkrn/c344256f4c13b310df2c4bb09568ca78 to your computer and use it in GitHub Desktop.
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