How to override an actor component function on parent in c++?

I have an actor component for a targeting system. basically, i do a sweep and get all the actors using that component in range. the thing is, I want to make some sort of a function on the component that gets called when it is locked on which the parent can override and do whatever like showing a sign above head or something. I want it as generic as possible, that’s why i made it into a component that I can add to any actor not a parent class or something, or do I have to use an interface here?

Use delegates, with them you can inject code to other class without the original class to be parent need for overriding, so for example actor which has component can easily bind to event without need to be component child or implement interfaces which are little messy in C++ (in UE4 specifically ;p)

You can make them BlueprintAssignable so you can bind events in blueprints to, most UE4 components use them so it’s quite common practice.