제목 : 예제. 기본 클래스의 메서드를 이용하는 프로그램
using System;
public class Memory
{
private object BrainCell;
public void Memorize(object Experience)
{
BrainCell = Experience;
}
public object Remember()
{
return BrainCell;
}
}
public class MemoryD : Memory
{
private object BrainCell;
public void MemorizeD(object Experience)
{
BrainCell = Experience;
}
public object RememberD()
{
return BrainCell;
}
}
public class Experience
{
public static void Main()
{
Console.WriteLine("무엇을 기억했습니까?");
string Experience = Console.ReadLine();
MemoryD xp = new MemoryD();
xp.Memorize(Experience);
Console.WriteLine("기억한 내용은 : {0}", xp.Remember());
}
}