Skip to content

Instantly share code, notes, and snippets.

@Wigny
Created March 24, 2020 01:44
Show Gist options
  • Save Wigny/c036c6cb935b1db7a5a42906a09aa563 to your computer and use it in GitHub Desktop.
Save Wigny/c036c6cb935b1db7a5a42906a09aa563 to your computer and use it in GitHub Desktop.
class Aluno {
String nome;
int idade;
Aluno(String nome, int idade) {
this.nome = nome;
this.idade = idade;
}
}
class Aula {
Aluno aluno;
String materia;
Aula(Aluno aluno, String materia){
this.aluno = aluno;
this.materia = materia;
}
}
void main() {
Aluno ivan = new Aluno('Ivan', 25);
Aula aula = new Aula(ivan, 'Testes');
print(aula.aluno.nome + ' tem aula de ' + aula.materia);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment