const with operator overloading
How would I approach overloading == and != with the following function headers:
1 2 3 4 5 6
|
bool operator == (const Friend& other)const{
return ((other.name == name) && (other.bday == bday);
}
bool operator != (const Friend& other)const{
return ((other.name != name) && (other.bday != bday);
}
|
The code within is what I thought was the valid way to approach this. The variables name and bday are within the Friend class and are private.
Look fine, except that you forgot a closing parenthesis.
Topic archived. No new replies allowed.