Question: Overload relational operator greater than operator> that can be used with the Date class. Test your new operators in the main problem. #include using

Overload relational operator greater than " operator>" that can be used with the Date class. Test your new operators in the main problem.

#include using namespace std;

class Date { // data declaration section private: int month; int day; int year;

// method declarations public: Date(int = 7, int = 4, int = 2005); // constructor int operator==(Date &); // declare the operator== function int operator>(Date &); int operator(date> };

// implementation section

Date::Date(int mm, int dd, int yyyy) { month = mm; day = dd; year = yyyy; }

int Date::operator==(Date &date2) { if(day == date2.day && month == date2.month && year == date2.year) return 1; else return 0; }

int main() { Date a(4,1,2007), b(12,18,2008), c(4,1,2007); // declare 3 objects

if (a == b) cout else cout

return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!