설명
인터페이스 선언 및 사용 예제
interface IAnimal
{
void MakeSound();
}
class Dog : IAnimal
{
public void MakeSound()
{
Console.WriteLine("Bark");
}
}
// 인터페이스 사용 예제
IAnimal animal = new Dog();
animal.MakeSound();
Console.WriteLine 예제코드
Console.WriteLine("hahaha");
출력
hahaha
Console.ReadLine 예제코드
string input = Console.ReadLine();
입력
1234
결과
input = '1234'
TryParse 예제코드
int num;
int.TryParse(input, out num)
결과
num = 1234