Avatar
omochimetaru 8/23/2017 8:39 AM
enum AnimalTypeSwitcher { case cat(Cat) case dog(Dog) } class Animal { var switcher: AnimalTypeSwitcher { fatalError("unimplemented") } } class Cat : Animal { var nya: Int = 3 override var switcher: AnimalTypeSwitcher { return .cat(self) } } class Dog : Animal { var wan: Float = 1.2 override var switcher: AnimalTypeSwitcher { return .dog(self) } }