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.
20 lines
334 B
20 lines
334 B
package patronTemplateMethod;
|
|
|
|
//clase Abstracta
|
|
public abstract class Automovil {
|
|
public void desplazar() {
|
|
acelerar();
|
|
cambiarMarcha();
|
|
frenar();
|
|
}
|
|
private void acelerar() {
|
|
System.out.println("Acelerando");
|
|
}
|
|
|
|
private void frenar() {
|
|
System.out.println("Frenando");
|
|
}
|
|
|
|
protected abstract void cambiarMarcha();
|
|
|
|
}
|
|
|