-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathmain.ts
69 lines (51 loc) · 1.84 KB
/
main.ts
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
import Breeder from './Breeder';
import Tool from './Tool';
import Fish from './Food/Fish';
import Bone from './Food/Bone';
import DogFood from './Food/DogFood';
import Dog from './Animal/Dog';
import Cat from './Animal/Cat';
class BreederManager {
private _breeder: Breeder = new Breeder();
async main() {
await this.testOne();
await this.testTwo();
await this.testThree();
}
async testThree() {
Tool.Log();
Tool.Log('----------------testThree---------------------');
const tom: Cat = new Cat('Tom');
const fish: Fish = new Fish('鱼', 25);
await this._breeder.feed(tom, fish);
}
async testTwo() {
Tool.Log();
Tool.Log('----------------testTwo---------------------');
const yelloDog: Dog = new Dog('黄狗');
const dogFood: DogFood = new DogFood('狗粮', 25);
await this._breeder.feed(yelloDog, dogFood);
Tool.Log('..........dev..........');
const bigBone: Bone = new Bone('小骨头', 50);
await this._breeder.feed(yelloDog, bigBone);
}
async testOne() {
Tool.Log();
Tool.Log('----------------testOne---------------------');
const xiaohuang: Dog = new Dog('小黄');
const smallBone: Bone = new Bone('小骨头', 25);
await this._breeder.feed(xiaohuang, smallBone);
Tool.Log('..........dev..........');
const dahuang: Dog = new Dog('大黄');
const bigBone: Bone = new Bone('大骨头', 50);
await this._breeder.feed(dahuang, bigBone);
Tool.Log('..........dev..........');
await this._breeder.feed(xiaohuang, bigBone);
Tool.Log('..........dev..........');
await this._breeder.feed(dahuang, smallBone);
}
get breeder(): Breeder{
return this._breeder;
}
}
new BreederManager().main();