Python multiple inheritance 👨‍👩‍👧‍👦

Publicado em: 25 Janeiro 2021
no canal de: Bro Code
23,518
1k

python multiple inheritance tutorial example explained

#python #multiple #inheritance

-----------------------------------------------------------------------------
multiple inheritance = when a child class is derived from more than one parent class

class Prey:

def flee(self):
print("This animal flees")

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()

-----------------------------------------------------------------------------

Bro Code merch store 👟 :
===========================================================
https://teespring.com/stores/bro-code-5
===========================================================


Nesta página do site você pode assistir ao vídeo on-line Python multiple inheritance 👨‍👩‍👧‍👦 duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Bro Code 25 Janeiro 2021, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 23,518 vezes e gostou 1 mil espectadores. Boa visualização!