Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Produto
- {
- String editora;
- int quantidade;
- double preco;
- // Construtor padrão
- Produto();
- // Construtor alternativo
- Produto.named(this.editora, [this.quantidade = 0, this.preco = 0]);
- }
- class Revista extends Produto
- {
- String _nome;
- int _volume;
- int _numero;
- Revista(this._nome, this._volume, this._numero);
- String get nome
- {
- return _nome;
- }
- int get volume
- {
- return _volume;
- }
- int get numero
- {
- return _numero;
- }
- }
- void main()
- {
- Revista rev1 = Revista("Veja", 23, 3);
- rev1.quantidade = 3;
- print(rev1.quantidade);
- rev1.editora = "Abril";
- print(rev1.editora);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement