VC6.0中的重载问题
把重载的函数体放在类中实现就可以了,代码如下:#include<iostream>#include<iomanip> using namespace std;//-------------------------------------------- class Date{ public:int year,month,day; void init(); public: Date(const string& s); Date(int y=2000,int m=1,int d=1); bool isLeapYear()const; friend ostream& operator<<(ostream& o,const Date& d){ o<<setfill('0')<<setw(4)<< ar<<"-"<<setw(2)<< nth<<"-"; return o<<setw(2)<<d。
day<<"-"<<setfill(' '); }};//-------------------------------------------- void Date::init() { if(year>5000 || year<1 || month<1 || month>12 || day<1 || day>31) exit(1);//停机 }//----------------------------------------------- Date::Date(const string& s) { year=atoi( bstr(0,4)。
c_str()); month=atoi( bstr(5,2)。c_str()); day=atoi( bstr(8,2)。
c_str()); init(); }//----------------------------------------------- Date::Date(int y,int m,int d) { year=y; month=m; day=d; init(); }//----------------------------------------------- bool Date::isLeapYear()const { return (year%4==0 && year%100)||year%400==0; }//----------------------------------------------- //----------------------------------------------- int main() { Date c(string("2005-12-28")); Date d(2003,12,6); Date e(2002); Date f(2002,12); Date g;cout<<c<<d<<e<<f<<g; return 0; }。
答:这个有很多详情>>
问:网络的进网络的进电脑买起了。该选择网络了。 他们说宽带(就拿艾普来说)比电信AD...
答:1.5M=0.5M ?没听说过,我就知道我家的2M=230KB,都说很正常,你还打算玩什么样的大型游戏?营业厅的给你说的天花乱坠,你问问给你装宽带的,根本不是那...详情>>