#polimorfismo
#def mostrar_tamanho(objeto):
#    print(f"O tamanho é: {len(objeto)}")
#mostrar_tamanho("Python")
#mostrar_tamanho([1, 2, 3])


class Smartphone:
    def ligar(self):
        print("Smartphone: tocando melodia de chamada")

class Notebook:
    def ligar(self):
        print("Notebook: iniciando Sistema Operacional")

class SmartTV:
    def ligar(self):
        print("SmartTV: mostrando logo da marca")  

#função que chama polimorfismo
def iniciar_dispositivo(dispositivo):
    dispositivo.ligar()

# objetos
celular = Smartphone()
laptop = Notebook()
tv = SmartTV()

iniciar_dispositivo(celular)
iniciar_dispositivo(laptop)
iniciar_dispositivo(tv)


Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: