[c++][GDExtention] Check if a variable is a type of custom class

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By YanDaik

How to check if a variable is a type of custom class (extended from Node3D) with c++?

:bust_in_silhouette: Reply From: YanDaik
void SomeClass::test_method(godot::Object *object)
{
        godot::Reference *r = godot::Object::cast_to<godot::Reference>(object);
        if (r) {
                r->reference();
        }

        SomeCustomType *custom = godot::Object::cast_to<SomeCustomType>(object);
        if (custom) {
                custom->some_custom_method();
        }
}