-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscratch.dart
77 lines (59 loc) · 1.19 KB
/
scratch.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// void main(){
// Square mySquare = Square();
// mySquare.colour = 'red';
// Square yoursquare = Square();
// yoursquare.colour = 'blue';
// Square().nosofsides;
// print(Icosagon.nosofsides);
// Circle.workourcircumference(radius: 15.6);
// }
// class Square{
// int nosofsides = 4;
// String colour;
// }
// class Icosagon{
// static int nosofsides = 20;
// }
// class Circle{
// static const double pi = 3.1415926;
// static void workourcircumference({double radius}){
// double circumference = 2* pi * radius;
// print(circumference);
// }
// }
void main(){
Animal().move();
Fish().move();
Bird().move();
}
class Animal{
void move(){
print('changed position');
}
}
class Fish extends Animal {
@override
void move(){
super.move();
print('by swimming');
}
}
class Bird extends Animal {
@override
void move(){
super.move();
print("by flying");
}
}
mixin CanSwim{
void move(){
print("changed position by swimming");
}
}
mixin CanFly{
void fly(){
print("changed position by flying");
}
}
class Duck extends Animal with CanSwim,CanFly{
}