这种写法可以说就不是多态了,这特么的是变态啊。
# -*- coding: utf-8 -*- class Animal(object): def speak(self): print("Hello, I'm is Animal.") class Dog(Animal): def speak(self): print("Hello, I'm is Puppy.") class Cat(Animal): def speak(self): print("Hello, I'm is Cat.") class Botany(object): def speak(self): print("Hello, I'm is Botany, HaHaHa.") def start_perform(animal): animal.speak() # if isinstance(animal, Animal): # animal.speak() # else: # raise TypeError("You're not a fucking animal!!!") start_perform(Botany())
打印结果:
Hello, I'm is Botany, HaHaHa.
i'm is .....兄die,初中英语复习下
是兄dei.好不好 拼音复习下
懂, 就完事了
Sign in to make a reply
___Hiboboo
这种写法可以说就不是多态了,这特么的是变态啊。
打印结果: