在 Dart 中,您只需创建一个abstract class并放置您希望其子项覆盖的所有方法。您还可以提供一个实现:
abstract class MyAbstractClass {
void method1(); // children must implement this method
void method2() { // this method already has an implementation
print("Just a print");
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1550 次 |
| 最近记录: |