struct : 상속 불가, 클래스는 선언과 생성을 같이 해야하지만, 구조체는 선언만 해도 내부적으로 생성을 해줌.
public struct Youtube1(구조체 이름)
{
int a;
int b = 5; // 오류 : 구조체는 값을 직접 넣을 수 없음.
public void GetA(int value)
{
a = value;
}
public int a;
public int b;
public int c;
public int d;
public Youtube1(int _a,int _b,int _c,int _d)
{
a = _a; b = _b; c = _c; d = _d;
}
}
Youtube1 awef;
awef.a = 5;
awef.GetA(5);
Youtube1 awef2 = new Youtube(1,2,3,4);
enum
public enum Item
{
Weapon,
Shield,
Potion,
}
Item item;
item = Item.Weapon;
item = Item.Shield;
print(item); // Shield 출력| 인터페이스(interface) (0) | 2024.06.21 |
|---|---|
| 프로퍼티(property) (0) | 2024.06.21 |
| 델리게이트, 이벤트 (0) | 2024.06.20 |
| arrayList, List, Hashtable, Dictionary, Queue, Stack (0) | 2024.06.19 |
| C# 메서드 정의 (0) | 2023.07.04 |