So i overloaded the operator < and tried to reuse this by just returning the complement of it for the > comparison operator.
I have been stuck at this error tho..
error C2679: binary '>' : no operator found which takes a right-hand operand of type 'const Customer' (or there is no acceptable conversion)
1> could be 'built-in C++ operator>(const Customer *, const Customer *)'
Could anyone give me some insight on issue here.. which I am guessing is a pointer/reference problem..
This is the testing method..
void main()
{
//tester of the Customer class...
Customer c, d;
c = Customer("bdbaaa", 'A', 1000);
d = Customer("bdbaa", 'H', 21100);
if (c > d)
{
cout << "YEH!";
}
This is the line(s) in the header:
..
bool operator <(const Customer &c) const;
bool operator >(const Customer &a) const;
This is the implementation in the cpp..
..
bool Customer::operator <(const Customer & t) const
{
//implementation here... this code for the < operator works perfectly fine..
}
bool Customer::operator >(const Customer &a) const
{
return !(this > a);
}