I have a class with the following
bool DistinctWord::operator==(const DistinctWord W) const
{
return strWord == W.strWord;
}
bool DistinctWord::operator==(const DistinctWord& W) const
{
return strWord == W.strWord;
}
I'm doing this in my program
DistinctWord* wordOne = new DistinctWord("Test");
DistinctWord* wordTwo = new DistinctWord("Test");
if(*wordOne == *wordTwo)
cout << "true";
else
cout << "false";
I get this error
error C2678: binary '==' : no operator found which takes a left-hand operand of type 'DistinctWord' (or there is no acceptable conversion) could be 'built-in C++ operator==(DistinctWord *, DistinctWord *
)'
I'm probably just not understanding the right way to overload.
Sorry for the simple question. TIA