//// 구조체 실습
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//namespace Structure
//{
// struct Point3D
// {
// public int X;
// public int Y;
// public int Z;
// public Point3D(int X, int Y, int Z)
// {
// this.X = X;
// this.Y = Y;
// this.Z = Z;
// }
// public override string ToString()
// {
// return string.Format("{0},{1},{2}", X, Y, Z);
// }
// }
// class jpcorp
// {
// static void Main(string[] args)
// {
// Point3D p3d1;
// p3d1.X = 10;
// p3d1.Y = 20;
// p3d1.Z = 30;
// Console.WriteLine(p3d1.ToString());
// Point3D p3d2 = new Point3D(100, 200, 300);
// Point3D p3d3 = p3d2;
// p3d3.Z = 400;
// Console.WriteLine(p3d2.ToString());
// Console.WriteLine(p3d3.ToString());
// }
// }
//}
////인터페이스
//// 변하지 못하는 선언만하는 부모클래스 같은 것이다. 상속 전용으로 사용할 수 있다.
//using System;
//using System.IO;
//namespace ILogger
//{
// interface ILogger
// {
// void WriteLog(string message);
// }
// class ConsoleLogger : ILogger
// {
// public void WriteLog(string message)
// {
// Console.WriteLine("{0},{1}", DateTime.Now.ToLocalTime(), message);
// }
// }
// class FileLogger : ILogger
// {
// private StreamWriter writer;
// public FileLogger(string path)
// {
// writer = File.CreateText(path);
// writer.AutoFlush = true;
// }
// public void WriteLog(string message)
// {
// writer.WriteLine("{0},{1}", DateTime.Now.ToShortTimeString(), message);
// }
// }
// class ClimateMonitor
// {
// private ILogger logger;
// public ClimateMonitor(ILogger logger)
// {
// this.logger = logger;
// }
// public void start()
// {
// while (true)
// {
// Console.Write(“온도를 입력해 주세요 : “);
// string temperature = Console.ReadLine();
// if (temperature == “”)
// break;
// logger.WriteLog(“현재 온도: " + temperature);
// }
// }
// }
// class jpcorp
// {
// static void Main(string[] args)
// {
// ClimateMonitor monitor = new ClimateMonitor(new FileLogger(“MyLog.txt”));
// monitor.start();
// }
// }
//}
////인터페이스를 상속하는 인터페이스
//using System;
//namespace DerivedInterface
//{
// interface ILogger
// {
// void WriteLog(string message);
// }
// interface IFormattableLoger : ILogger //인터페이스가 인터페이스를 상속한다.
// {
// void WriteLog(string format, params Object[] args);
// }
// class ConsoleLogger2 : IFormattableLoger
// {
// public void WriteLog(string message)
// {
// Console.WriteLine("{0},{1}”, DateTime.Now.ToLocalTime(), message);
// }
// public void WriteLog(string format, params Object[] args)
// {
// string message = String.Format(format, args);
// Console.WriteLine("{0},{1}”, DateTime.Now.ToLocalTime(), message);
// }
// }
// class jpcorp
// {
// static void Main(string[] args)
// {
// IFormattableLoger logger = new ConsoleLogger2();
// logger.WriteLog(“The World is not Flat”);
// logger.WriteLog("{0}+ {1}={2}” , 1,1,2);
// }
// }
//}
//// 인터페이스 다중 상속
//using System;
//namespace MultiInterfaceInheritance
//{
// interface IRunnable
// {
// void Run();
// }
// interface IFlyable
// {
// void Fly();
// }
// class FlyingCar : IRunnable, IFlyable
// {
// public void Run()
// {
// Console.WriteLine(“Run, Run!!”);
// }
// public void Fly()
// {
// Console.WriteLine(“Fly, Fly!!”);
// }
// }
// class jpcorp
// {
// static void Main(string[] args)
// {
// FlyingCar car = new FlyingCar();
// car.Run();
// car.Fly();
// IRunnable runnable = car as IRunnable;
// runnable.Run();
// IFlyable flyable = car as IFlyable;
// flyable.Fly();
// }
// }
//}
//// 추상 클래스
//using System;
//namespace AbstractClass
//{
// abstract class AbstractBase
// {
// protected void PrivateMethodA()
// {
// Console.WriteLine(“AbstractBase.PrivateMethodA()”);
// }
// public void PublicMerthodA()
// {
// Console.WriteLine(“AbstractBase.PublicMerhodA()”);
// }
// public abstract void AbstracMethodA();
// }
// class Derived : AbstractBase
// {
// public override void AbstracMethodA()
// {
// Console.WriteLine(“Derived.AbstracrMethodA()”);
// PrivateMethodA();
// }
// }
// class jpcorp
// {
// static void Main(string[] args)
// {
// AbstractBase obj = new Derived();
// obj.AbstracMethodA();
// obj.PublicMerthodA();
// }
// }
//}
////프로퍼티
//using System;
//namespace Property
//{
// class BirthDatInfo
// {
// private string name;
// private DateTime birthday;
// public string Name
// {
// get
// {
// return name;
// }
// set
// {
// name = value;
// }
// }
// public DateTime BirthDay
// {
// get
// {
// return birthday;
// }
// set
// {
// birthday = value;
// }
// }
// public int Age
// {
// get
// {
// return new DateTime(DateTime.Now.Subtract(birthday).Ticks).Year;
// }
// }
// }
// class jpcorp
// {
// static void Main(string[] args)
// {
// BirthDatInfo birth = new BirthDatInfo();
// birth.Name = “서현”;
// birth.BirthDay = new DateTime(1991, 6, 28);
// Console.WriteLine(“Name :{0}”, birth.Name);
// Console.WriteLine(“Birthday :{0}”, birth.BirthDay.ToShortDateString());
// Console.WriteLine(“Age :{0}”, birth.Age);
// }
// }
//}
////자동 구현 프로퍼티
//using System;
//namespace AutoImplementedProperty
//{
// class BirthdayInfo
// {
// public string Name
// {
// get;
// set;
// }
// public DateTime Birthday
// {
// get;
// set;
// }
// public int Age
// {
// get
// {
// return new DateTime(DateTime.Now.Subtract(Birthday).Ticks).Year;
// }
// }
// }
// class jpcorp
// {
// static void Main(string[] args)
// {
// BirthdayInfo birth = new BirthdayInfo();
// birth.Name = " 서현";
// birth.Birthday = new DateTime(1991,6,28);
// Console.WriteLine(“Name : {0} “, birth.Name);
// Console.WriteLine(“Birthday : {0} " , birth.Birthday.ToShortDateString());
// Console.WriteLine(“Age : {0}",birth.Age);
// }
// }
//}