帮我看看这个程序有什么问题吧?
#include<iostream.h>
//file Date.h
class Date
{
public:
Date():_year(0),_month(0),_day(0){}
Date(int year, int month, int day):_year(year),_month(month),_day(day){}
void Print()
{
cout<<"year:"<<_year<<" month:"<<_month<<" day:"<<_day<<endl;
}
private:
int _year;
int _month;
int _day;
};
//end file Date.h
//file Person.h
class Person
{
public:
Person(){};
Person(char* their_name, char* email,int year,int month,int day)
:name(their_name),email_address(email),date(year,month,day){}
char * GetName();
char * GetEmailAddress();
Date GetBirthDate();
void Print()
{
date.Print();
cout<<"name is "<<name<<" email is "<<email_address<<endl;
}
private:
char* name;
char* email_address;
Date date;
}; //end file Person.h
void main()
{
Person p("yts",417,3,6,1992);
p.Print();
}
private:
char* name;
char* email_address; //这里是char型指针
Date date;
}; //end file Person.h
void main()
{
Person p("yts",417,3,6,1992); //这里的417是int常量!
p.Print();
}