Unreal Engine에서 상위 클래스의 가상 함수를 오버라이딩할 때, Super::함수이름을 호출해야 하는 경우가 많다. 이 호출은 상위 클래스의 기본 동작을 유지하거나 확장하려는 목적으로 사용된다.
#include "GameFramework/Actor.h"
#include "MyActor.generated.h"
UCLASS()
class MYGAME_API AMyActor : public AActor
{
GENERATED_BODY()
public:
virtual void BeginPlay() override;
};
void AMyActor::BeginPlay()
{
// 상위 클래스의 BeginPlay 호출
Super::BeginPlay();
// 추가 작업
UE_LOG(LogTemp, Warning, TEXT("AMyActor BeginPlay Called!"));
}