Created
January 5, 2016 15:41
-
-
Save rhynl/95e632d812aa4e92fd85 to your computer and use it in GitHub Desktop.
Clases y Herencia en JavaScript
This file contains hidden or 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
| 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'); | |
| } |
This file contains hidden or 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 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