Discuss / Python / 整合

整合

Topic source

好学者

#1 Created at ... [Delete] [Delete and Lock User]
class Animal(object):    def run(self):        print('Animal is running...')class Dog(Animal):    def run(self):        print('Dog is running...')class Cat(Animal):    def run(self):        print('Cat is running...')dog = Dog()dog.run()cat = Cat()cat.run()def run_twice(animal):    animal.run()    animal.run()class Tortoise(Animal):    def run(self):        print('Tortoise is running slowly...')run_twice(Tortoise())

  • 1

Reply