Python 33 Programming Tutorial - Multiple Inheritance

class Mario():
    def move(self):
        print('I am Mario!')


class Shroom():
    def eat_shroom(self):
        print('Now I am big!')


class BigMario(Mario, Shroom):
    pass


bm = BigMario()
bm.move()
bm.eat_shroom()

你可能感兴趣的:(Python 33 Programming Tutorial - Multiple Inheritance)