forked from sheng-jie/Design-Pattern
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
42 lines (32 loc) · 1.1 KB
/
Program.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DecoratorPattern
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("装饰模式:");
Console.WriteLine("-------------------------------------------------");
Console.WriteLine("先看毛坯房:");
//未经装修的毛坯房
var withoutDecoratorHouse = new WithoutDecoratorHouse()
{
Area = 80.0,
Specification="三室一厅一卫",
Price = 8000
};
withoutDecoratorHouse.Show();
Console.WriteLine("-------------------------------------------------");
Console.WriteLine("再看样板房:");
//对毛坯房进行装修
var decoratorHouse = new ModelHouse(withoutDecoratorHouse);
decoratorHouse.Show();
Console.WriteLine("-------------------------------------------------");
Console.ReadLine();
}
}
}