Created
November 27, 2020 20:23
-
-
Save catalunha/8238397e973b1b6dae6845a8afa526dc to your computer and use it in GitHub Desktop.
Resumo Dart - POO - exemplo static
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 Produto { | |
String nome; | |
Produto(this.nome); | |
static int visto = 0; | |
@override | |
String toString() { | |
return 'Produto $nome Visto: $visto'; | |
} | |
} | |
void main() { | |
Produto produto1 = Produto('a'); | |
Produto.visto++; | |
print(produto1); | |
Produto produto2 = Produto('b'); | |
Produto.visto++; | |
print(produto2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment