diff --git a/DesignPattern/DesignPattern.sln b/DesignPattern/DesignPattern.sln
index 4dcf93b..1cd5abc 100644
--- a/DesignPattern/DesignPattern.sln
+++ b/DesignPattern/DesignPattern.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.3.32811.315
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.32630.194
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Singleton", "Singleton\Singleton.csproj", "{37FE4D0C-A213-4EA5-B3EF-DB2DB3971ACE}"
EndProject
@@ -27,6 +27,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Proxy", "Proxy\Proxy.csproj
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Iterator", "Iterator\Iterator.csproj", "{FB64AA57-5E45-4DD9-B152-8548CFDD235F}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Visitor", "Visitor\Visitor.csproj", "{A34872B5-83A1-4C3C-B20C-24A46DA39E3F}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -81,6 +83,10 @@ Global
{FB64AA57-5E45-4DD9-B152-8548CFDD235F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FB64AA57-5E45-4DD9-B152-8548CFDD235F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FB64AA57-5E45-4DD9-B152-8548CFDD235F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A34872B5-83A1-4C3C-B20C-24A46DA39E3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A34872B5-83A1-4C3C-B20C-24A46DA39E3F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A34872B5-83A1-4C3C-B20C-24A46DA39E3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A34872B5-83A1-4C3C-B20C-24A46DA39E3F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/DesignPattern/Visitor/App.config b/DesignPattern/Visitor/App.config
new file mode 100644
index 0000000..aee9adf
--- /dev/null
+++ b/DesignPattern/Visitor/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DesignPattern/Visitor/Body.cs b/DesignPattern/Visitor/Body.cs
new file mode 100644
index 0000000..41509b6
--- /dev/null
+++ b/DesignPattern/Visitor/Body.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Visitor
+{
+ class Body : ICarElement
+ {
+ public string Color => "Siver";
+
+ public void Accept(ICarVisitor visitor)
+ {
+ visitor.Visit(this);
+ }
+ }
+}
diff --git a/DesignPattern/Visitor/Car.cs b/DesignPattern/Visitor/Car.cs
new file mode 100644
index 0000000..bad4101
--- /dev/null
+++ b/DesignPattern/Visitor/Car.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Visitor
+{
+ class Car : ICarElement
+ {
+ public string Maker => "BMW";
+ private List elements;
+
+ public Car()
+ {
+ elements = new List
+ {
+ new Engine(),
+ new Body(),
+ new Wheel()
+ };
+ }
+
+ public void Accept(ICarVisitor visitor)
+ {
+ foreach (ICarElement elem in elements)
+ {
+ elem.Accept(visitor);
+ }
+
+ visitor.Visit(this);
+ }
+ }
+}
diff --git a/DesignPattern/Visitor/CarPrintVisitor.cs b/DesignPattern/Visitor/CarPrintVisitor.cs
new file mode 100644
index 0000000..bd3dc1c
--- /dev/null
+++ b/DesignPattern/Visitor/CarPrintVisitor.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Visitor
+{
+ class CarPrintVisitor : ICarVisitor
+ {
+ public void Visit(Engine element)
+ {
+ Console.WriteLine(element.Spec);
+ }
+
+ public void Visit(Body element)
+ {
+ Console.WriteLine(element.Color);
+ }
+
+ public void Visit(Wheel element)
+ {
+ Console.WriteLine(element.Type);
+ }
+
+ public void Visit(Car element)
+ {
+ Console.WriteLine(element.Maker);
+ }
+ }
+}
diff --git a/DesignPattern/Visitor/Client.cs b/DesignPattern/Visitor/Client.cs
new file mode 100644
index 0000000..8a1c2f2
--- /dev/null
+++ b/DesignPattern/Visitor/Client.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Visitor
+{
+ class Client
+ {
+ public static void HowToTest()
+ {
+ ICarElement car = new Car();
+ ICarVisitor visitor = new CarPrintVisitor();
+ car.Accept(visitor);
+ }
+ }
+}
diff --git a/DesignPattern/Visitor/Engine.cs b/DesignPattern/Visitor/Engine.cs
new file mode 100644
index 0000000..be12f20
--- /dev/null
+++ b/DesignPattern/Visitor/Engine.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Visitor
+{
+ class Engine : ICarElement
+ {
+ public string Spec => "V4";
+
+ public void Accept(ICarVisitor visitor)
+ {
+ visitor.Visit(this);
+ }
+ }
+}
diff --git a/DesignPattern/Visitor/ICarElement.cs b/DesignPattern/Visitor/ICarElement.cs
new file mode 100644
index 0000000..c00a603
--- /dev/null
+++ b/DesignPattern/Visitor/ICarElement.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Visitor
+{
+ interface ICarElement
+ {
+ void Accept(ICarVisitor visitor);
+ }
+}
diff --git a/DesignPattern/Visitor/ICarVisitor.cs b/DesignPattern/Visitor/ICarVisitor.cs
new file mode 100644
index 0000000..973d978
--- /dev/null
+++ b/DesignPattern/Visitor/ICarVisitor.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Visitor
+{
+ interface ICarVisitor
+ {
+ void Visit(Engine element);
+ void Visit(Body element);
+ void Visit(Wheel elemetn);
+ void Visit(Car element);
+ }
+}
diff --git a/DesignPattern/Visitor/Program.cs b/DesignPattern/Visitor/Program.cs
new file mode 100644
index 0000000..81db3e2
--- /dev/null
+++ b/DesignPattern/Visitor/Program.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Visitor
+{
+ /*
+ * 카테고리: 행위 패턴
+ * 개요: 집합적 객체의 각 요소에 대해 새로운 동작을 추가하기 위해
+ * 각 요소 클래스를 일일이 수정하지 않고 별도의 Visitor 클래스를 정의하여 새 동작을 추가함
+ */
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ Client.HowToTest();
+
+ Console.ReadKey();
+ }
+ }
+}
diff --git a/DesignPattern/Visitor/Properties/AssemblyInfo.cs b/DesignPattern/Visitor/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..96b7399
--- /dev/null
+++ b/DesignPattern/Visitor/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
+// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
+// 이러한 특성 값을 변경하세요.
+[assembly: AssemblyTitle("Visitor")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Visitor")]
+[assembly: AssemblyCopyright("Copyright © 2022")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
+// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
+// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
+[assembly: ComVisible(false)]
+
+// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
+[assembly: Guid("a34872b5-83a1-4c3c-b20c-24a46da39e3f")]
+
+// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
+//
+// 주 버전
+// 부 버전
+// 빌드 번호
+// 수정 버전
+//
+// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
+// 기본값으로 할 수 있습니다.
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/DesignPattern/Visitor/Visitor.csproj b/DesignPattern/Visitor/Visitor.csproj
new file mode 100644
index 0000000..54f63c8
--- /dev/null
+++ b/DesignPattern/Visitor/Visitor.csproj
@@ -0,0 +1,61 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {A34872B5-83A1-4C3C-B20C-24A46DA39E3F}
+ Exe
+ Visitor
+ Visitor
+ v4.8.1
+ 512
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DesignPattern/Visitor/Wheel.cs b/DesignPattern/Visitor/Wheel.cs
new file mode 100644
index 0000000..a088413
--- /dev/null
+++ b/DesignPattern/Visitor/Wheel.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Visitor
+{
+ class Wheel : ICarElement
+ {
+ public string Type => "P26";
+
+ public void Accept(ICarVisitor visitor)
+ {
+ visitor.Visit(this);
+ }
+ }
+}