void main() { Dog dog = Dog(); dog.name = '小狗'; dog.public(); dog.swim(); dog.walk(); } abstract class Animal { String name; void public(); } abstract class SwimAbility { void swim(); } abstract class WalkAbility { void walk(); } //implements接口和extends配合实现类似java的多继承 class Dog extends Animal implements SwimAbility, WalkAbility { @override void public() { print('动物的名字是:$name'); } @override void swim() { print('${name}有游泳的能力'); } @override void walk() { print('${name}有跑步的能力'); } }
dart笔记8:dart abstract抽象类和接口实现多继承效果
dart笔记8:dart abstract抽象类和接口实现多继承效果