-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetterGetter.dart
More file actions
78 lines (61 loc) · 1.15 KB
/
Copy pathsetterGetter.dart
File metadata and controls
78 lines (61 loc) · 1.15 KB
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
78
//setter getter
class spacecraft {
String? _name;
DateTime? launch;
String? get getName {
return _name;
}
set setName(String? Name) {
_name = Name;
}
set setTime(DateTime? Launcedate) {
launch = Launcedate;
}
DateTime? get getDatetime {
return launch;
}
void info() {
print(_name);
print(launch);
}
void dateTIme(DateTime date) {
print("Birthdate: ${date}");
}
}
class cat extends spacecraft {
String Cname = "";
String color = "";
set Setname(String Name) {
_name = Name;
}
String get GtNmae {
return Cname;
}
set Setcolor(String Color) {
color = Color;
}
String get GEtcolor {
return color;
}
nameColor() {
print("Cate name: ${_name}");
print("cat color: $color");
}
}
void main() {
spacecraft s1 = spacecraft();
s1.setName = "voyger";
s1.setTime = DateTime(1987, 5, 10);
// s1.info();
// print("name of spacecraft: ${s1.getName}");
// print("launch time: ${s1.getDatetime}");
cat c1 = cat();
c1.Setname = "Kitty";
c1.Setcolor = "brown";
var x = c1.setTime = DateTime(
2012,
12,
);
c1.dateTIme(x);
c1.nameColor();
}