调用的参数问题

#include <iostream.h>

class CDate
{
public:
 CDate();
 CDate(int day);
 CDate(int month,int day);
 CDate(int year,int month,int day);
private:
 int nYear,nMonth,nDay;
};

CDate::CDate()
{
 nMonth=7;
 nDay=31;
 nYear=2002;
 cout<<nYear<<"-"<<nMonth<<"-"<<nDay<<endl;
}

CDate::CDate(int day)
{
 nMonth=7;
 nDay=day;
 nYear=2002;
 cout<<nYear<<"-"<<nMonth<<"-"<<nDay<<endl;
}

void main()
{
 CDate day1;  //当此处写为 CDate day1() 时将忽略不执行
 CDate day2(28);
}

 

你可能感兴趣的:(include)