//关闭空调
this.closeAC();
}
}
有了模板,接下来创建几个集成这个抽象类模板的类,也就是所谓的不同的车:
第一辆车,
/**
-
@Author : JCccc
-
@CreateTime : 2019-1-14
-
@Description :
-
@Point: Keep a good mood
**/
public class Audi extends VehicleControlModel {
@Override
protected void startEngine() {
System.out.println(“奥迪 启动发动机”);
}
@Override
protected void shutDownEngine() {
System.out.println(“奥迪 关闭发动机”);
}
@Override
protected void openAC() {
System.out.println(“奥迪 空调开启”);
}
@Override
protected void closeAC() {
System.out.println(“奥迪 空调关闭”);
}
}
第二辆车:
/**
-
@Author : JCccc
-
@CreateTime : 2