Multiple Inheritance In Python Is Easy!🐍

preview_player
Показать описание
PLEASE LIKE AND SUBSCRIBE ITS FREE!

#beginners #tutorial #python

Check out my other videos to learn more computer science & programming concepts please :)

Code used in the video will be pinned in the comments!

Socials and other platforms:
Рекомендации по теме
Комментарии
Автор

# when a child class having multiple parent classes

class Prey:
def flee(self):
print("This animal is fleeing")

class Predator:
def hunt(self):
print("This animal is hunting")

class Rabbit(Prey):
pass

class Hawk(Predator):
pass

class Fish(Prey, Predator):
pass

rabbit = Rabbit()
hawk = Hawk()
fish = Fish()

# rabbit.flee()
# hawk.hunt()
fish.flee()
fish.hunt()

YousefCompSci
join shbcf.ru