인터페이스 : 인터페이스끼리 다중상속 가능, 클래스에서도 다중 인터페이스 상속 가능
- 함수, 프로퍼티, 인덱서, 이벤트만 인터페이스 안에 정의 가능.
int a; 처럼 변수 선언 불가
- 추상화처럼 abstract, override 쓰지 않음.
public interface IFlyable
{
void Fly();
}
public interface ISwimmable
{
void Swim();
}
public class Duck : IFlyable, ISwimmable
{
public void Fly()
{
Console.WriteLine("The duck is flying.");
}
public void Swim()
{
Console.WriteLine("The duck is swimming.");
}
}
예외처리 ( try, catch, finally, throw ) (0) | 2024.06.21 |
---|---|
Action Func (0) | 2024.06.21 |
프로퍼티(property) (0) | 2024.06.21 |
델리게이트, 이벤트 (0) | 2024.06.20 |
구조체(Struct), 열거형(enum) (0) | 2024.06.19 |