Skip to content

Instantly share code, notes, and snippets.

@Felipe00
Created May 4, 2017 14:24
Show Gist options
  • Save Felipe00/07af8588e210dee695e75a685ff9b48e to your computer and use it in GitHub Desktop.
Save Felipe00/07af8588e210dee695e75a685ff9b48e to your computer and use it in GitHub Desktop.
Exemplo de uso de herança
class Monster extends Enemy {
private String monsterName;
protected void monsterfy() {
this.monsterName = "Monster " + getRandomId(); // comando qualquer
}
}
class People extends Monster {
// quando a classe for criada, eu quero que o método monsterfy() execute como um "init()"
public void bePeople() {
// comandos
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment