Created
March 23, 2016 01:47
-
-
Save lricoy/161860e8b25e189b7923 to your computer and use it in GitHub Desktop.
ES2015 classes
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
// Declaração da classe | |
class Funcionario extends Pessoa { | |
// Método construtor | |
constructor(cargo) { | |
// Chama o construtor da classe Pessoa | |
super(cargo); | |
this.foo = 'foo'; | |
} | |
// Método da instância. Ex: new Funcionario(').alterar | |
alterarCargo(novoCargo) { | |
this.cargo = novoCargo; | |
} | |
// Método estático. Ex: Funcionario.cargoValido(); | |
static cargoValido() { | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment