Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #MULTI-LEVEL INHERITANCE = WHEN A DERIVED (CHILD) CLASS INHERITS ANOTHER DERIVED (CHILD) CLASS
- #--------------
- class Organism:
- alive = True
- class Animal(Organism):
- def eat(self):
- print("This animal is eating")
- class Dog(Animal):
- def bark(self):
- print("This dog is barking")
- dog = Dog()
- print(dog.alive)
- dog.eat()
- dog.bark()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement