super
class Person { int age; string name; Person(int age, String name){ this.age = age; this.name = name; } void sayhi(){ print('my name is' this.name) } } class Worker extend Person{ int salary; Worker(int age, string name, int salary) : super(age, name){ //super表示要继承父类的属性 this.salary = salary; } @override //告诉编译器和程序员他是一个重写覆盖父类的方法 void sayhi(){
super.sayhi() //表示调用父类的sayhi方法 print('my salary is'+ this.salary) } }