You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
498 B
26 lines
498 B
3 years ago
|
package patronComposite;
|
||
|
|
||
|
public class Hoja extends Componente{
|
||
|
public Hoja(String nombre) {
|
||
|
super(nombre);
|
||
|
}
|
||
|
|
||
|
public void add(Componente c) {
|
||
|
System.out.println("No se puede, es una hoja");
|
||
|
}
|
||
|
|
||
|
public void Eliminar(Componente c) {
|
||
|
System.out.println("No se puede, es una hoja");
|
||
|
}
|
||
|
|
||
|
|
||
|
public Componente ObtenerHijo(int profundidad) {
|
||
|
System.out.println("No se puede, es una hoja");
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
public void Operacion() {
|
||
|
System.out.println("-" + nombre);
|
||
|
}
|
||
|
}
|