Inheritance and Overriding methods

Inheritance enable us to define a class that takes all the functionality from parent class and allows us to add more. Method overriding occurs simply defining in the child class a method with the same name of a method in the parent class . When you define a method in the object you make this latter able to satisfy that method call, so the implementations of its ancestors do not come in play. example
class BaseClass: def OverrideMethod(self): print("BaseClass->OverrideMethod") def BeaseMethod(self): print("BaseClass->BeaseMethod") class DerivedClass(BaseClass): def OverrideMethod(self): print("DerivedClass->OverrideMethod") def testMethod(x): x.OverrideMethod() x.BeaseMethod() testMethod(BaseClass()) testMethod(DerivedClass())
BaseClass->OverrideMethod BaseClass->BeaseMethod DerivedClass->OverrideMethod BaseClass->BeaseMethod