forked from WeihanLi/DesignPatterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
32 lines (25 loc) · 819 Bytes
/
Program.cs
File metadata and controls
32 lines (25 loc) · 819 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
using System;
namespace VisitorPattern
{
public class Program
{
public static void Main(string[] args)
{
#region Prototype
var o = new ObjectStructure();
o.Attach(new ConcreteElementA());
o.Attach(new ConcreteElementB());
o.Accept(new ConcreteVisitor1());
o.Accept(new ConcreteVisitor2());
Console.WriteLine();
#endregion Prototype
var personStructure = new PersonStructure();
personStructure.Attact(new Man());
personStructure.Attact(new Woman());
personStructure.Display(new Success());
personStructure.Display(new Fail());
personStructure.Display(new Marriage());
Console.ReadLine();
}
}
}