展开全部
#include
#include
using namespace std;
/**-----------------------------------------------------------------------------
* 常量声明
*------------------------------------------------------------------------------
*/
const int c_defaultYear = 2007; //默认年份
const int c_defaultMonth = 10; //默认月份
const int c_defaultDay = 10; //默认日期
#define CESHI //如果要做主函数测试,将62616964757a686964616fe4b893e5b19e31333238646362此行注释即可
/**-----------------------------------------------------------------------------
* CDate类声明段
*------------------------------------------------------------------------------
*/
class CDate
{
public:
CDate(); //构造函数
CDate(int a,int b,int c); //带参数的构造函数
CDate(const CDate &p); //copy构造函数
~CDate(); //析构函数
public:
int getYear() const; //返回年份
int getMonth() const; //返回月份
int getDay() const; //返回日期
bool isLeap() const; //返回是否是闰年
bool isLeap();
void print(); //打印
private:
bool isittrue(int,int,int); //检测是否有误
void defaultset(); //使用默认设置
private:
int m_Year; //年
int m_Month; //月
int m_Day; //日
static int sn; //静态变量
};
int CDate::sn = 1; //初始化静态变量
/**----------------------------------------------------------------