#include
using namespace std;
class Date
{
public:
int GetMonthDay(int year, int month)
{
int monthArray[13] = { 0, 31, 28, 30 };
if (month2&& year%4 == 0&& year%100!=0 || year%400 == 0)
return 29;
else
return monthArray[month];
}
//四个成员函数
Date(int year = 2019, int month = 1, int day = 1)
{
if (year > 0 && month<13 && day>0 && day <= GetMonthDay(year, month))
{
_year = year;
_month = month;
_day = day;
}
else
{
cout << “日期非法” << endl;
}
}
bool operator(const Date& d);
bool operator!=(const Date& d);
bool operator>(const Date& d);
bool operator<(const Date& d);
bool operator>=(const Date& d);