Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- 언리얼
- redirection crash
- unreal engine
- Random Map Generator
- Unreal Engine Error
- 랜덤 맵 생성
- 리디렉션 크래쉬
- Ai
- 리디렉터 크래쉬
- splinemeshcomponent scale
- LittleNightMare
- UE4
- tscriptinterface
- ue4 Crash
- UE
- unreal engine redirection crash
- 13iew
- UnrealEngine
- ue4 error
- Unreal Engine 5
- Unreal Engine 4
- redirector crash
- change textblock color
- skill system
- deltaTime
- register component
- unreal engine skill
- staticmesh mobility
- unity
- UE5
Archives
- Today
- Total
Class GameDev* SheepAdult
[Unreal Engine 4.27 C++] PURE_VIRTUAL Macro는 순수 가상 함수인가? 본문
Unreal Engine
[Unreal Engine 4.27 C++] PURE_VIRTUAL Macro는 순수 가상 함수인가?
SheepAdult 2022. 8. 21. 15:22언리얼에 내장되어 있는 Interface 클래스가 아닌 다른 클래스에서 가상 함수를 만들어보면
// AMaster_InteractableObject.h
public:
UFUNCTION()
virtual void Interact() PURE_VIRTUAL(AMaster_InteractableObject::Interact, );
과 같이 보통 작성한다. 저 PURE_VIRTUAL을 보면 순수 가상함수를 말하는 것 같아 " = 0"으로 작성해도 똑같지 않을까 해서 아래와 같이 고치고 컴파일하면
public:
UFUNCTION()
virtual void Interact() = 0;
"해당 클래스를 인스턴스화 할 수 없습니다"라는 에러가 뜨게 된다.
찾아보니 언리얼 오브젝트의 최상위 오브젝트인 UObject는 모두 인스턴스화 될 수 있는 성질을 가지고 있어, 인스턴스화 할 수 없는 성질을 가진 interface class와 충돌을 하나보다. 그래서 PURE_VIRTUAL을 붙여줌으로써 마치 가상 함수를 선언한 함수에서도 구현해 준 듯한 기능을 해주게 하는 것 같다.