class mammal(object):
def eat(self):
print('eat meat....')
class Bird(object):
print('eat vegetables....')
class FlyMixIn(object):
def fly(self):
print('flying....')
class RunMixIn(object):
def run(self):
print('running....')
class Dog(mammal,RunMixIn):
pass
class Parrot(Bird,FlyMixIn):
class Bat(mammal,FlyMixIn):
class Ostrich(Bird,RunMixIn):
dog=Dog()
dog.run()
dog.eat()
parrot=Parrot()
parrot.fly()
parrot.eat()
Sign in to make a reply
用户6786697361_46373
class mammal(object):
def eat(self):
print('eat meat....')
class Bird(object):
def eat(self):
print('eat vegetables....')
class FlyMixIn(object):
def fly(self):
print('flying....')
class RunMixIn(object):
def run(self):
print('running....')
class Dog(mammal,RunMixIn):
pass
class Parrot(Bird,FlyMixIn):
pass
class Bat(mammal,FlyMixIn):
pass
class Ostrich(Bird,RunMixIn):
pass
dog=Dog()
dog.run()
dog.eat()
parrot=Parrot()
parrot.fly()
parrot.eat()