Python Object-Oriented Python Inheritance Super!

shivang goyal
shivang goyal
2,003 Points

object-oriented python super()

why we can't use or override add_item method in our subclass like super().add_item(self,item) why we define function again in subclass

inventory.py
class Inventory:
    def __init__(self):
        self.slots = []

    def add_item(self, item):
        self.slots.append(item)
class SortedInventory(Inventory):
    def add_item(self,item):
        super().add_item(item)