Created
November 25, 2021 23:07
-
-
Save felipecastrosales/a90a5596506bb34b250a5ab0af4f789d to your computer and use it in GitHub Desktop.
Reescrita de Métodos - POO 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main(){ | |
Animal animal = Animal(); | |
animal.comunicacao(); | |
Cachorro doge = Cachorro(); | |
doge.comunicacao(); | |
Gato gato = Gato(); | |
gato.comunicacao(); | |
} | |
class Animal { | |
void comunicacao() { | |
print('O animal se comunica: '); | |
} | |
} | |
class Cachorro extends Animal { | |
@override | |
void comunicacao() { | |
print('O cachorro se comunica: latindo'); | |
} | |
} | |
class Gato extends Animal { | |
@override | |
void comunicacao() { | |
print('O gato se comunica: miando'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment