forked from FengJungle/DesignPattern
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
46 lines (40 loc) · 945 Bytes
/
main.cpp
File metadata and controls
46 lines (40 loc) · 945 Bytes
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
#include <iostream>
#include "DecoratorPattern.h"
int main()
{
printf("\nJungle's first phone\n");
Component *c;
Component *com_Shell;
c = new Phone();
com_Shell = new DecoratorShell(c);
com_Shell->operation();
printf("\nJungle's second phone'\n");
Component *c2;
Component *com_Shell2;
c2 = new Phone();
com_Shell2 = new DecoratorShell(c2);
Component *com_Sticker;
com_Sticker = new DecoratorSticker(com_Shell2);
com_Sticker->operation();
printf("\nJungle's third phone'\n");
Component *c3;
Component *com_Shell3;
c3 = new Phone();
com_Shell3 = new DecoratorShell(c3);
Component *com_Sticker2;
com_Sticker2 = new DecoratorSticker(com_Shell3);
Component *com_Rope;
com_Rope = new DecoratorRope(com_Sticker2);
com_Rope->operation();
printf("\n\n");
delete c;
delete com_Shell;
delete c2;
delete com_Shell2;
delete com_Sticker;
delete c3;
delete com_Sticker2;
delete com_Rope;
system("pause");
return 0;
}