반응형
using System;
interface IAdd
{
int Add(int a, int b);
}
interface IMinus
{
int Minus(int a , int b);
}
abstract class abMethod
{
public int Add(int a, int b)
{
int tot = a+b;
return tot;
}
public abstract int Minus(int a, int b);
}
class NewInter : IAdd , IMinus
{
public int Add(int a, int b)
{
int add= a+b;
return add;
}
public int Minus(int a, int b)
{
int m = a-b;
return m;
}
}
class ABtest : abMethod
{
public override int Minus(int a, int b)
{
int m= a-b;
return m;
}
}
class Maintest
{
public static void Main()
{
Console.WriteLine("interface");
NewInter inter = new NewInter();
Console.WriteLine("Add(3,4)=>"+inter.Add(3,4));
Console.WriteLine("Minus(3,4)=>"+inter.Minus(3,4));
Console.WriteLine("abstract");
abMethod ab = new ABtest();
Console.WriteLine("Add(3,4)=>"+ab.Add(3,4));
Console.WriteLine("Minus(3,4)=>" + ab.Minus(3, 4));
}
}
'Writer > WarmingUp Code' 카테고리의 다른 글
메모장 만들기(MDI)포함 (0) | 2008.10.29 |
---|---|
C# Thread 스레드 (0) | 2008.10.29 |
C# 객체생성과제 (0) | 2008.10.20 |
C# 과제 (0) | 2008.10.17 |
델리게이트 이벤트 소스 노가다 2 (0) | 2008.10.14 |
델리게이트 이벤트 소스 노가다 (0) | 2008.10.13 |
눈물의 소스 박스형 for와 if 사용 첨부 상철 상봉 오윤 (0) | 2008.10.09 |
소스 복습 (0) | 2008.10.08 |