Created
May 4, 2017 14:24
-
-
Save Felipe00/07af8588e210dee695e75a685ff9b48e to your computer and use it in GitHub Desktop.
Exemplo de uso de herança
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 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