Skip to content

Instantly share code, notes, and snippets.

@catalunha
Last active August 31, 2023 19:16
Show Gist options
  • Save catalunha/c3127e6ad506e2481cd40077dd445a14 to your computer and use it in GitHub Desktop.
Save catalunha/c3127e6ad506e2481cd40077dd445a14 to your computer and use it in GitHub Desktop.
Resumo Dart - POO - Exemplo class Funcionario

Resumo Dart - POO - Exemplo class Funcionario

Created with <3 with dartpad.dev.

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