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]);
- String get editora
- {
- return _editora;
- }
- }
- class Revista extends Produto
- {
- String _nome;
- int _volume;
- int _numero;
- Revista(String nome, int volume, int numero, String editora) : super.named(editora)
- {
- this._nome = nome;
- this._volume = volume;
- this._numero = numero;
- }
- String get nome
- {
- return _nome;
- }
- int get volume
- {
- return _volume;
- }
- int get numero
- {
- return _numero;
- }
- }
- void main()
- {
- Revista rev1 = Revista("Veja", 23, 3, "Abril");
- rev1.quantidade = 3;
- rev1.preco = 10.50;
- print("Nome: ${rev1.nome}");
- print("Volume: ${rev1.volume}");
- print("Numero: ${rev1.numero}");
- print("Editora: ${rev1.editora}");
- print("Quantidade: ${rev1.quantidade}");
- print("Preço: ${rev1.preco}");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement