I am receiving the error "binary ‘==’: no operator found which takes a right-hand operand of type ‘ABasicCharacter’ (or there is no acceptable conversion)
I’ve tried all possibly ways I can think of to overload this operator, but have been unsuccessful. I assume I am misunderstanding something simple. Here is some simplified example code. Please ignore that the data it holds does not make sense as well as the function names.
The error occurs in the function “TestFunction”
This was originally working when my TArray was
TArray<DataClass>* DataArray,
//but then I changed it to
TArray<DataClass*>* DataArray
//due to some changes in my coding. (Pointer to TArray of objects TO Pointer to TArray of pointers)
-
class ABasicCharacter
{
public:
TArray<DataClass*>* DataArray;
int UniqueCode;int GetUniqueCode_ABasicCharacterClass() const { return UniqueCode; } void TestFunction() { bool Outcome = DataArray->FindByKey(*this); //Error here, FindByKey is not recognizing my overloaded function. }
};
class DataClass
{
public:
int UniqueCode;
int GetUniqueCode_DataClass() const
{
return UniqueCode;
}
inline bool operator==(const ABasicCharacter& RHS) const
{
return this->GetUniqueCode_DataClass() == RHS.GetUniqueCode_ABasicCharacterClass();
}
};