Skip to content

Instantly share code, notes, and snippets.

@rhynl
Created January 5, 2016 15:41
Show Gist options
  • Select an option

  • Save rhynl/95e632d812aa4e92fd85 to your computer and use it in GitHub Desktop.

Select an option

Save rhynl/95e632d812aa4e92fd85 to your computer and use it in GitHub Desktop.
Clases y Herencia en JavaScript
var Carro = function Carro (nombre, tipo) {
Vehiculo.call(this, name, tipo);
this.encender(encender);
this.combustible = '';
};
Carro.prototype = Object.create(Vehiculo.prototype);
Carro.prototype.constructor = Carro;
Carro.prototype.default = function () {
return new Carro('miCarro','sedan');
}
class Carro extends Vehiculo {
constructor(nombre, tipo) {
super(nombre, tipo);
this.encender = encender;
this.combustible = '';
}
static default () {
return new Carro('miCarro', 'Sedan');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment