LoginSignup
0
0

More than 3 years have passed since last update.

多重継承

Posted at
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() #Car runと出力される→先に呼ばれた方のクラスのメソッドが実行される
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0