Access methods of HitActor made from blueprint (based on C++ parent class)

Hi. I am learning Unreal alongside C++ and have lost somewhere between C++ derived Blueprint and OutHit.

The setup:
I have a UsableObject parent class that provides a simple UseObject() method that for now just ulog “Object can be used”. Then I created a child class called Door that also has UseObject() method that should output “Doors opened”. At the end I’ve created Blueprint derived from Door class (for now I didn’t handle meshes from c++) to add skeletal mesh and place it on a level.

The player has a component named ObjectHandler that is doing SweepSingleByChannel() and on HitResult I would like to access UseObject method but the only thing I could figure out, for now, is casting to AUsableObject that is outputting standard ‘Object can be used’.

This is how I access it now:

FHitResult HitResult;
if (UObjectHandler::GetObjectInReach(HitResult) && !hasHit) {
  AActor* HitActor = HitResult.GetActor();
  if (HitActor->GetClass()->IsChildOf(AUsableObject::StaticClass())) {
    AUsableObject* UsableObject = Cast<AUsableObject>(HitActor);
	UsableObject->UseObject();
  }
}

I guess the problem is with virtual/override keywords for USeObject(), but when I add them I got a linker error.

The base class:

virtual void UseObject()

and then override in child class

void UseObject() override;

I got this error:

CompilerResultsLog: Undefined symbols for architecture x86_64:
CompilerResultsLog: “ADoor::UseObject()”, referenced from:
CompilerResultsLog: vtable for ADoor in Door.gen.cpp.o
CompilerResultsLog: ld: symbol(s) not found for architecture x86_64
CompilerResultsLog: clang: error: linker command failed with exit code 1 (use -v to see invocation)

Can someone point me to right path here? :wink:

Ok. I found a stupid error… in child class I did

void UseObject()

Instead of

void ADoor::UseObject()

■■■■!!!