is is possible to check whether a virtual function is override from parent class

i have create a parent class and define some virtual function members. in the setup logic, i want to know whether any specific virtual member is override by the sub class, which is the runtime this.

the problem is that i know the parent class, but can not detect which sub class it is. i can not use standard c++ way to check whether a virtual function is override. list as below:

if constexpr (!std::is_same_v<decltype(&Derived::foo), decltype(&Base::foo)>) {
    std::cout << "overrided" << std::endl;
}

from Is there a way to detect if a function is overridden?

is there any ue5 function, macro i can use?
thank u very much.

below is an image description for the logic i want to do. this logic is designed to be written in the parent class

Decorate OnTriggered with UFUNCTION, then you can do this :

if (GetClass()->FindFunctionByName("OnTriggered") != ThisClass::StaticClass()->FindFunctionByName("OnTriggered"))
{
    // is overriden
}

This should work for blueprint overrides also (for BlueprintNativeEvent).

1 Like

thank u very much, this do work