How to override the function from base class in the subclass in C++?

Hi , I want to call the one function from the base class to override under subclass so I don’t need to re-write the new function with the same functionality.

Base Class function:

UFUNCTION(BlueprintCallable, BlueprintPure , Category = "Getter")
void GetDistance(int32&  Distance);

I want to call this function in the Sub class to override:

UFUNCTION(BlueprintCallable, BlueprintPure , Category = "Getter")
void GetDistance(int32&  Distance) override;

The problem is the code doesn’t compiled with error:
Member Functin doesn’t override the base class member

Thank You

baseclass

UFUNCTION(BlueprintCallable, BlueprintPure , Category = "Getter")
virtual void MyFunction();

subclass

virtual void MyFunction() override;
2 Likes

Sir, Thank You very much for the quick and perfect solution :slight_smile:

1 Like

Glad it helps you )

1 Like