Super的使用
abstract class Report {
void runReport(){
// 设置报告
}
void printReport(){
// 输出
}
}
class Buzzwordsreport extends Report {
void runReport(){
super.runReport();
buzzwordComplinance();
printReport();
}
void buzzwordComplinance(){...}
}
如果在子类中指定下面的命令:
super.runReport();
父类的方法就会执行.
对子类的对象调用就回去执行子类覆盖过的方法,但在子类中可以去调用父类的方法
super如果要使用的话,需要在自己代码的最前面,否则会报错