I\'m attempting to check if two objects are equal by overloading the \'==\' operator for the class. Based on everything I\'ve read here on Stack Overflow and elsewhere, for exa
Your current operator==
assumes the objects to be at the same address, so if you did something like
PossibleChar p1;
PossibleChar p2 = p1;
std::cout << p1 == p2 << '\n';
it would print false
.
If that is indeed what you want, alright.
If it is not, you will need to define an operator==
, which compares all necessary1 members of the objects, not the addresses.
1 "necessary" means "members defining the state of the object" here, that is, it depends on the class which members should be compared.