Files
flutter-todos/test/mixin_test.dart
oldchen 07cc44442c 🔨: Clean code
2019-09-09 12:45:06 +08:00

51 lines
777 B
Dart

import 'package:test/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();
});
}