class Unit:

    def __init__(self):

        print("Unit 생성자")



class Flyable:

    def __init__(self):

        print("Flyable 생성자")



# 생성자가 2개일 경우 super 사용시 하나만 사용이 가능하다.

# 2개일 경우 super사용 없이 따로 사용해야 된다.

class FlyableUnit(Flyable, Unit):

    def __init__(self):

        # super().__init__()

        Unit.__init__(self)

        Flyable.__init__(self)



# 드랍쉽

dropship = FlyableUnit()

 

'Python' 카테고리의 다른 글

Python-init  (0) 2020.07.05
Python-class (스타크래프트 예시)  (0) 2020.07.05
Python-pass  (0) 2020.07.05
Python-메소드 오버라이딩  (0) 2020.07.05
Python-다중상속  (0) 2020.07.05

+ Recent posts