Avatar
@swiftbot protocol AnimalProtocol {} extension AnimalProtocol { mutating func replace(with obj: Self) { self = obj } } class AnimalBase : AnimalProtocol {} class Cat: AnimalBase {} class Dog: AnimalBase {} var cat: AnimalBase = Cat() cat.replace(with: Dog()) print(type(of: cat)) a
🛠 1