Skip to content

Instantly share code, notes, and snippets.

@DiegoPinho
Created September 22, 2017 16:22
Show Gist options
  • Save DiegoPinho/2cb6c33e2944875791bde5a74ff7afad to your computer and use it in GitHub Desktop.
Save DiegoPinho/2cb6c33e2944875791bde5a74ff7afad to your computer and use it in GitHub Desktop.
class Carro {
constructor(modelo,marca) {
this.modelo = modelo;
this.marca = marca;
}
andar() {
console.log('vrum vrum');
}
}
class ModeloA extends Carro {
constructor(modelo, marca, cor) {
super(modelo, marca);
this.cor = cor;
}
}
const carro = new ModeloA('A', 'Fiat', 'Amarelo');
console.log(carro.modelo, carro.marca, carro.cor);
carro.andar(); // vrum vrum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment