How to Call Parent Function in FTimerManager

I have a C++ class in which I want to use a FTimerManager to call a function at certain intervals. The parent class has the function I want to call but I can’t get it to compile.

FTimerManager &TimerManager = GetWorld()->GetTimerManager();
if (!TimerManager.IsTimerActive(BurstTimerHandle))
{
    // this fails to compile
    TimerManager.SetTimer(TheTimerHandle, this, &UTheChild::FunctionInParentClass, Rate, false);
}

FTimerManager &TimerManager = GetWorld()->GetTimerManager();
if (!TimerManager.IsTimerActive(BurstTimerHandle))
{
    // this also fails to compile
    TimerManager.SetTimer(TheTimerHandle, this, &UTheParent::FunctionInParentClass, Rate, false);
}

FTimerManager &TimerManager = GetWorld()->GetTimerManager();
if (!TimerManager.IsTimerActive(BurstTimerHandle))
{
    // this compiles successfully
    TimerManager.SetTimer(TheTimerHandle, this, &UTheChild::FunctionInChildClass, Rate, false);
}

The Error

error C2664: ‘void FTimerManager::SetTimer(FTimerHandle &,TFunction &&,float,bool,float)’: cannot convert argument 3 from ‘int32 (__cdecl UTheParent::* )(void)’ to ‘void (__cdecl UTheChild::* )(void)’


**How can I go about calling a function in a parent class using a FTimerManager?**

Is the parent returning a value? They need to be void.

You could try:

  1. You could do &ParentClass::ParentFunction in the TimerManager class.
  2. Create a funciton with the same name in the child and call super from within that function, and in the TimerManager then do &ChildClass::FunctionInChildClass.

This was it. The parent function was returning int32. I didnt want to to change it to void so I created a wrapper function that is void and calls the parent function. Thanks for the assistance.