31 lines
603 B
Java
31 lines
603 B
Java
package lab16_composite.ex1;
|
|
|
|
public class Player implements Entity {
|
|
private int number;
|
|
|
|
public Player(int number) {
|
|
this.number = number;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "[Player " + number + "]";
|
|
}
|
|
|
|
public void cry() {
|
|
System.out.println(this + " ouin ouin");
|
|
}
|
|
|
|
public void enterField() {
|
|
System.out.println(this + " let's go !");
|
|
}
|
|
|
|
public void simulateInjury() {
|
|
System.out.println(this + " ouch !");
|
|
}
|
|
|
|
public void shoot() {
|
|
System.out.println(this + " encara Messi...");
|
|
}
|
|
}
|