Error C2575 -- Declaring virtual function

When trying to declare a virtual function that returns a user-defined struct, I receive the error “Error C2575 ‘ReturnValidCoordinates’: only member functions and bases can be virtual”. Here is my code:

UCLASS()
class PROJECTORDER_API AParent_Piece : public AActor
{
	GENERATED_BODY()

public:	
	// Sets default values for this actor's properties
	AParent_Piece();
	
	virtual TArray<FBoardCoordinate> ReturnValidCoordinates();
}

and in the cpp file:

virtual TArray<FBoardCoordinate> ReturnValidCoordinates()
{
	TArray<FBoardCoordinate> Coordinates;

	return Coordinates;
}

Does anyone know the cause of this?
Thanks in advance!

you only want to use virtual in the header file not the your cpp

h

virtual TArray<FBoardCoordinate> ReturnValidCoordinates();

cpp

TArray<FBoardCoordinate> AParent_Piece::ReturnValidCoordinates()
 {
     TArray<FBoardCoordinate> Coordinates;
 
     return Coordinates;
 }

perfect, thanks!