Created with <3 with dartpad.dev.
Last active
August 31, 2023 19:16
-
-
Save catalunha/c3127e6ad506e2481cd40077dd445a14 to your computer and use it in GitHub Desktop.
Resumo Dart - POO - Exemplo class Funcionario
This file contains 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
class Pessoa { | |
String nome; | |
Pessoa(this.nome); | |
String mostrar() { | |
return '$nome'; | |
} | |
} | |
class Funcionario extends Pessoa { | |
String matricula; | |
Funcionario(super.nome, this.matricula); | |
String mostrar() { | |
return '$nome $matricula'; | |
} | |
} | |
void main() { | |
Pessoa p1 = Pessoa('joao'); | |
Pessoa p2 = Funcionario('maria', '123'); | |
print(p1.mostrar()); | |
print(p2.mostrar()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment