Overriding

    [Python] overrides 라이브러리 (리스코브 치환 원칙)

    [Python] overrides 라이브러리 (리스코브 치환 원칙)

    Introduction 파이썬에서 클래스 계층 구조를 확장시키다 보면 부모 클래스의 메서드를 오버라이딩 (overriding) 해야 할 일이 분명히 있을 것이다. 오버라이딩이란 부모 클래스를 상속받는 자식 클래스에서, 부모 클래스에서 이미 정의된 메서드를 새로 정의하는 행위를 뜻한다. 아래의 코드를 참고하자. class FooClass(): def __init__(self): pass def foo_function(self): print("Foo function.") return class FooChildClass(FooClass): def __init__(self): pass # Method overrided. def foo_function(self): super().foo_function() prin..