第一次写c++遇到问题
看书上一个例子,为什么运行有问题 ?//Date.h
#include <iostream.h>
class Date
{
private:
int mouth;
int date;
int year;
public:
Date(int m = 2, int d = 1, int y = 2008)
{
mouth = m;
date = d;
year = y;
}
Date(Date &d)
{
mouth = d.mouth;
date = d.date;
year = d.year;
}
~Date()
{}
void printDate()
{
cout<<month<<"-"<<date<<"-"<<year<<endl;
}
}
//Date.cpp
#include "Date.h"
void main()
{
Date today(2, 3, 2008);
Date someday;
Date someday2(today);
today.printDate();
someday.printDate();
someday2.printDate();
//return 0;
}