using System;
namespace Study06
{
class Program
{
static void Main(string[] args)
{
App app = new App();
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Study06
{
class App
{
public App()
{
Templar templar0 = new Templar();
Templar templar1 = new Templar();
Archon archon = templar0.Merge(templar1);
archon.Move(2, 3);
archon.Move(0,0);
archon.Move(-2, -3);
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Study06
{
class Templar
{
public Templar()
{
Console.WriteLine("templar 생성");
Console.WriteLine();
}
public Archon Merge(Templar templar)
{
Console.WriteLine("템플러가 합성되었습니다");
Console.WriteLine();
Archon archon = new Archon();
return archon;
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Study06
{
class Archon
{
public Archon()
{
Console.WriteLine("archon 생성");
Console.WriteLine();
}
public void Move(int x, int y)
{
if (x < 0)
Console.WriteLine("왼쪽으로 {0}만큼 이동합니다", x);
else if (x > 0)
Console.WriteLine("오른쪽으로 {0}만큼 이동합니다", x);
if (y < 0)
Console.WriteLine("아래쪽으로 {0}만큼 이동합니다", y);
else if (y > 0)
Console.WriteLine("위쪽으로 {0}만큼 이동합니다", y);
if (x==0 && y==0)
Console.WriteLine("이동하지 않았습니다");
Console.WriteLine();
}
}
}