I have a struct with an enum value and a function that converts said enum value to a string:
USTRUCT(BlueprintType)
struct FClassicNeed
{
// UENUM
EClassicNeedName Name;
FString FClassicNeed::ReturnNameAsString(EClassicNeedName InName = this->Name)
{
// Long and probably unnecessary code
}
}
However, using this->Name
(or even this.Name
) doesn’t work. I get an error C2355: 'this': can only be referenced inside non-static member functions or non-static data member initializers
. I’ve tried it as well with FString ReturnNameAsString(...)
, but with the same error.
I don’t quite understand this, and Google/Stack Exchange didn’t have a working answer. What is wrong with that argument? The function is non-static, isn’t it?