File tree 2 files changed +10
-12
lines changed
2 files changed +10
-12
lines changed Original file line number Diff line number Diff line change 1
1
abstract class Shape {
2
- int x;
3
- int y;
2
+ late int x;
3
+ late int y;
4
4
Shape clone ();
5
5
}
6
6
7
7
class Rectangle implements Shape {
8
- int height;
9
- int width;
10
- int x;
11
- int y;
8
+ late int height;
9
+ late int width;
10
+ late int x;
11
+ late int y;
12
12
13
- int _hashCode;
13
+ late int _hashCode;
14
14
bool isClone = false ;
15
15
String get cloneStatus => isClone ? "is a clone" : "is an original gangster" ;
16
16
@@ -32,7 +32,6 @@ class Rectangle implements Shape {
32
32
33
33
@override
34
34
int get hashCode {
35
- if (_hashCode != null ) return _hashCode;
36
35
_hashCode = DateTime .now ().millisecondsSinceEpoch;
37
36
return _hashCode;
38
37
}
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ abstract class Subject {
3
3
}
4
4
5
5
class ExpensiveClass implements Subject {
6
- String name;
6
+ late String name;
7
7
8
8
ExpensiveClass (this .name);
9
9
@@ -13,8 +13,8 @@ class ExpensiveClass implements Subject {
13
13
}
14
14
15
15
class Proxy implements Subject {
16
- String _name;
17
- ExpensiveClass _sub;
16
+ late String _name;
17
+ late ExpensiveClass _sub;
18
18
19
19
Proxy (this ._name);
20
20
@@ -24,7 +24,6 @@ class Proxy implements Subject {
24
24
}
25
25
26
26
ExpensiveClass _subject () {
27
- if (_sub != null ) return _sub;
28
27
print ("Creating an instance of ExpensiveClass for the proxy..." );
29
28
_sub = ExpensiveClass (_name);
30
29
return _sub;
You can’t perform that action at this time.
0 commit comments