class 자식클래스(부모클래스):
메서드들...
class Animal():
def walk(self):
print("걷는다.")
def eat(self):
print("먹는다.")
class Human(Animal):
def wave(self):
print("손을 흔든다.")
class Dog(Animal):
def wag(self):
print("꼬리를 흔든다.")
class 자식클래스(부모클래스1, 부모클래스2, 부모클래스3):
메서드들...
class Animal( ):
def __init__( self, name ):
self.name = name
def greet( self ):
print( "인사한다" )
class Human( Animal ):
def __init__( self, name, hand ):
super().__init__( name ) # 부모클래스의 __init__ 메소드 호출
self.hand = hand
def greet( self ):
print( "손을 흔든다" )
super().greet()
class Dog( Animal ):
def greet( self ):
print( "꼬리를 흔든다" )
person = Human("사람", "오른손")