Inheritance
Chef.py
class Chef: @staticmethod def make_chicken(self): print("The chef makes a chicken.") @staticmethod def make_salad(self): print("The chef makes a salad.") @staticmethod def make_special_dish(self): print("The chef makes bbq ribs.")
ChineseChef.py
from Chef import Chef class ChineseChef(Chef): @staticmethod def make_special_dish(self): print("The chef makes orange chicken.") @staticmethod def make_friend_rice(self): print("The chef makes fried rice.")
from Chef import Chef from ChineseChef import ChineseChef myChef = Chef() myChef.make_chicken(myChef) myChef.make_special_dish(myChef) myChineseChef = ChineseChef() myChineseChef.make_chicken(myChineseChef) myChineseChef.make_special_dish(myChineseChef) //Output : The chef makes a chicken. // The chef makes bbq ribs. // The chef makes a chicken. // The chef makes orange chicken.