How to declare Parent BeginPlay function in C++?

Hi, what is the parent begin play function in C++ and how we can write one if we need?

In blueprint it looks like this
image_2022-06-15_002937804

Super::BeginPlay()

It literally is just the BeginPlay function as implemented by the parent class, and calling that in the child class will call the parent class’ BeginPlay function.

The main class has the BeginPlay() function and its sub class also has the BeginPlay() function, so I need to call that Super::BeginPlay() in the subclass BeginPlay() function?

void ASubCharacter::BeginPlay()
{
   Super::BeginPlay()
}

this is right?

Yep, need a semicolon at the end though.

The functions that are marked as virtual can be re-implemented by child classes using override. Calling Super::Function() then calls the implementation in the parent class.

If the function had any input parameters those need to be provided as well.

2 Likes

Thank You Sir for the clear and to the point guide, and yes it was a type just here, in VS I don’t have this type. :smiley: