Binding Delegates across classes (From Comp to Actor)

Hello,

I’m a bit confused when it comes to Delegate Binding across classes on C++ from Children components to their Parent Actors. I know that blueprints make this pretty straightforward through the Add Event function. However, I haven’t found an adequate way to do this via C++.

285260-ue4-delegates-1.png

This image is what I want to do in C++. the Delegate in the image has been declared within a C++ Component; I’m looking for insights of how to declare the equivalent of this on a C++ Actor. How should I declare it and bind it within said Actor?

I’ve tried what is in this post but it hasn’t worked in my end.
https://forums.unrealengine.com/community/community-content-tools-and-tutorials/13915-tutorial-creating-and-using-delegates-c-and-accessing-them-in-blueprints

Try the following setup:

/*Multi-cast delegate declartion inside your header file*/
DECLARE_MULTICAST_DELEGATE_ThreeParams(MyDelegate, FHitResult, bool, float);

//Must be marked as ufunction, otherwise your code won't execute
UFUNCTION()
void DoSomething(FHitResult HitResult, bool bWasBlocked, float Multiplier);

And somewhere in your C++ do:

//Delegate declaration
MyDelegate Del;

//Binding a function
//First parameter means that the function DoSomething exists inside the same C++ object    
MyDel.BindUFunction(this, FName("DoSomething"));

//Executing the DoSomething function
MyDel.Broadcast(YourHitResultData,true,1.f);

For more information regarding delgates this post may provide some insight.