Modes of method inheritance - override


Replace method


examples/oop/inheritance/override.py
class Parent():
    def greet(self):
        print("Hello World")

class Child(Parent):
    def greet(self):
        print("Hi five!")

p = Parent()
p.greet()    # Hello World

c  = Child()
c.greet()    # Hi five!

Hello World
Hi five!
Hello World