Quick question: what is the syntax of calling grandparent override function?

Hi!

If I created a class C from parent class B (which is inherited from class A)

I can call Super::Tick() in class C to call the override function of parent class (class B).

My question is, how do I call the grandparent function Tick() within class C? Super::Super::Tick() ??

I know there’s a way to call it, but I forgot what the syntax is, could someone help me out? Many thanks!

Super is just a Unreal Engine shorthand for the name of the parent class.

If you have a class derived from Character and you want to call a Pawn function you simply write


APawn::

instead of


Super::

Ah! That actually makes a lot of sense, I could just adopt the C++ way of calling grandparent function!

For some reason, I kept thinking UE4 has a special wrapper function for calling a grandparent function and I just couldn’t figure it out…

Thank you for your answer! Very appreciated! =)

IIRC you can also recursively call Super:



Super::Super::BeginPlay()


3 Likes