mirror of
https://github.com/asjqkkkk/flutter-todos.git
synced 2025-08-06 14:19:24 +08:00
51 lines
793 B
Dart
51 lines
793 B
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
|
|
|
|
class Walker{
|
|
void todo(){
|
|
print("\n我能走路\n");
|
|
}
|
|
}
|
|
|
|
class Pilot{
|
|
void todo(){
|
|
print("\n我能飞\n");
|
|
}
|
|
}
|
|
|
|
class Jumper{
|
|
void todo(){
|
|
print("\n我能跳\n");
|
|
}
|
|
}
|
|
|
|
class PersonOne with Pilot, Jumper{
|
|
PersonOne(){
|
|
print("${this.runtimeType}");
|
|
}
|
|
}
|
|
|
|
class PersonTwo with Walker, Jumper{
|
|
PersonTwo(){
|
|
print("${this.runtimeType}");
|
|
}
|
|
}
|
|
|
|
class PersonThree with Walker, Pilot{
|
|
PersonThree(){
|
|
print("${this.runtimeType}");
|
|
}
|
|
}
|
|
|
|
void main(){
|
|
test(("测试mixin机制:\n"), (){
|
|
|
|
print(DateTime.now().millisecondsSinceEpoch);
|
|
|
|
// PersonOne personOne = PersonOne()..todo();
|
|
// PersonTwo personTwo = PersonTwo()..todo();
|
|
// PersonThree personThree = PersonThree()..todo();
|
|
});
|
|
|
|
} |