Multiple inheritance

class Person(object):
    def run(self):
        print('Person run')


class Car(object):
    def run(self):
        print('Car run')


class PersonCarRobot(Car,Person):
    def fly(self):
        pass


person_car_robot = PersonCarRobot()
person_car_robot.run() #Output as Car run → The method of the class called earlier is executed

Recommended Posts

Multiple inheritance
Class inheritance
Python #inheritance (inheritance)
[Python] What is inherited by multiple inheritance?
About python inheritance
EP 26 Use Multiple Inheritance Only for Mix-in Utility Classes