protocol Sound { func makeSound() }
extension Sound {
func makeSound() {
print("Wow")
}
}
protocol Flyable {
func fly()
}
extension Flyable {
func fly() {
print("✈️")
}
}
class Airplane: Flyable { }
class Pigeon: Sound, Flyable { }
class Penguin: Sound { }
let pigeon = Pigeon()
pigeon.fly() // prints ✈️
pigeon.makeSound() // prints Wow
the above code works fine but, I need to print different types of sound (I.E). if I call the airplane.fly() it should print me ("something different") . and same for penguin