Download

Use of Super in a class

Someone can explain to me the use of Super inside the code below.

AShooterCharacter::AShooterCharacter(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer.SetDefaultSubobjectClass(ACharacter::CharacterMovementComponentName))
{
Mesh1P = ObjectInitializer.CreateDefaultSubobject(this, TEXT(“PawnMesh1P”));

In UnrealEngine, Super is an alias for the parent class. So if ACharacter is the parent of AShooterCharacter, then Super is the same as ACharacter.

3 Likes