Avatar
@swift-4.0.3 protocol Animal {} extension Animal { init(_animal: Self) { self = _animal } } class AnimalBase: Animal { convenience init(with animal: AnimalBase) { self.init(_animal: animal) } } class Cat: AnimalBase { let _name = "Tama" var name: String { return _name } func bark() { print("cat \(self.name)") } } class Dog: AnimalBase {} let animal = Cat(with: Dog()) animal.bark() (edited)