Virtual function override error

I’m getting a virtual function override error with return type.

I have a class that is a child of APawn. In this class I use a movement component derived from ACharacterMovementComponent.

I try to override the virtual const function APawn::GetMovementComponent(), but it’s giving me an error claiming my movement component is not a covariant. The APawn::GetMovementComponent() returns UPawnMovementComponent, my CustomClass:GetMovementComponent() returns UCustomMovementComponent which is a covariant via UPawnMovementComponent-UCharacterMovementComponent-UCustomMovementComponent.

Is this a c++ feature (not recognising covariance from twice inherited classes) or a ue4 feature?

My syntax was wrong and I was a toad.

I was trying to do in .h:

virtual UCustomMovementComponent* GetMovementComponent() const override;

and in cpp

UCustomMovementComponent CustomClass::GetMovementComponent const
{
return MovementComponent;
}

while I should have in .h:

virtual UPawnMovementComponent* GetMovementComponent() const override;

and .cpp returning APawnMovementComponent. [Redacted] I felt stupid…because of course my CustomMovementComponent is APawnMovementComponent.

STAFF EDIT: removed profanity