Advertisement
everblut

PersonaHeredada

Jan 18th, 2012
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. /*Herencia*/
  2. public class PersonaHereda extends Persona{
  3.  
  4.     private Boolean corazon;
  5.  
  6.     public PersonaHereda(){
  7.     super(); /* Con super mandas llamar a la clase "padre" */
  8.          
  9.     }
  10.  
  11.     @Override
  12.     public void hable(){
  13.     System.out.println("No, no pienso hablarte! i'm "+nombre);
  14.     }
  15.    
  16.     public void Morir(){
  17.     this.vida = 0;
  18.     System.out.println("Me asesinaron :'c encuentren al culpable");
  19.     }
  20.  
  21.     public void Morir(String nombre){
  22.     this.vida = 0;
  23.     System.out.println("Oh ya me mori :( capturen al asesino: "
  24.                +nombre);
  25.     }
  26.    
  27.     public void setVida(int vida){
  28.     this.vida = vida;
  29.     System.out.println("Gracias, me diste "+vida+"de vida <3");
  30.     }
  31.  
  32.     /*Poliformismo*/
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement