Initial commit

This commit is contained in:
toly
2023-04-16 10:28:45 +08:00
commit a1465d4a52
139 changed files with 5073 additions and 0 deletions

14
test/grammer/oop/01.dart Normal file
View File

@@ -0,0 +1,14 @@
class Human {
String name = '';
double weight = 0;
double height = 0;
}
void main(){
Human toly = Human();
toly.name = "捷特";
toly.weight = 70;
toly.height = 180;
print("Human: name{${toly.name},weight:${toly.weight}kg,height:${toly.height}cm}");
}

12
test/grammer/oop/02.dart Normal file
View File

@@ -0,0 +1,12 @@
class Human {
String name = '';
double weight = 0;
double height = 0;
Human(this.name,this.weight,this.height);
}
void main(){
Human toly = Human("捷特",70,180);
print("Human: name{${toly.name},weight:${toly.weight}kg,height:${toly.height}cm}");
}

52
test/grammer/oop/03.dart Normal file
View File

@@ -0,0 +1,52 @@
class Human {
String name = '';
double weight = 0;
double height = 0;
Human(this.name, this.weight, this.height);
String info() {
return "Human: name{${name},weight:${weight}kg,height:${height}cm}";
}
}
void main() {
Human toly = Human("捷特", 70, 180);
print(toly.info());
Human ls = Human("龙少", 65, 179);
print(ls.info());
Human wy = Human("巫缨", 65, 179);
print(wy.info());
}

40
test/grammer/oop/04.dart Normal file
View File

@@ -0,0 +1,40 @@
class Human {
String name = '';
double weight = 0;
double height = 0;
Human(this.name, this.weight, this.height);
double bmi() {
double result = weight / ((height/100) * (height/100));
return result;
}
String info() {
return "Human: name{${name},weight:${weight}kg,height:${height}cm}";
}
}
class Student extends Human {
final String school;
Student(
super.name,
super.weight,
super.height, {
required this.school,
});
@override
String info() {
String info = super.info() + "school: $school ";
return info;
}
}
void main() {
Student toly = Student("捷特", 70, 180,school: "安徽建筑大学");
print(toly.bmi());
print(toly.info());
}