编译中出现的错误,大家帮忙看看,谢谢
//如果是闰年,打印年月日
#include <iostream>
#include <iomanip>
using namespace std;
class Date
{
private:
int year, month, day;
public:
void set(int y, int m, int d);
bool isLeapYear() const;
void print() const;
};
inline void Date::set(int y, int m, int d)
{
year=y, month=m, day=d;
}
inline bool Date::isLeapYear()
{
return ( (year%4==0 && year%100!=0) || year%400==0 );
}
inline void Date::print()
{
cout << setfill('0');
cout << setw(4) << year << "-"
<< setw(2) << month << "-"
<< setw(2) << day << endl;
}
int main()
{
Date *dp = new Date;
dp->set(2000,12,12);
if( dp->isLeapYear())
dp->print();
else
cout << "not a LeapYear.";
return 0;
}
错误信息://怎么会有重载的错?真不明白。
C:\临时\f08032.cpp(21) : error C2511: 'isLeapYear' : overloaded member function 'bool (void)' not found in 'Date'
C:\临时\f08032.cpp(6) : see declaration of 'Date'
C:\临时\f08032.cpp(26) : error C2511: 'print' : overloaded member function 'void (void)' not found in 'Date'