Python Classroom notes 02/Jul/2026

Inheritence contd–Overriding

  • Method overriding means the child class changes the behavior of a method from the parent class

class Animal:
    def make_sound(self):
        print("........")

class Dog(Animal):
    def make_sound(self):
        print("bark")

class Cat(Animal):
    def make_sound(self):
        print("meow")

animal = Animal()
cat = Cat()
dog = Dog()
print("Animal")
animal.make_sound()
print("Cat")
cat.make_sound()
print("Dog")
dog.make_sound()


  • Super(): super means call the parent version of this method

  • Multi Level Inheritence:

Animal
Dog
Puppy
  • Multiple inheritence: Where one class inherits from more than one parent class

  • Refer Here for the notebook

By continuous learner

enthusiastic technology learner

Leave a Reply

Discover more from Direct AI Powered By Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading