关于两个基类的问题
本人刚学类,程序运行通不过,麻烦各位看一下#include "iostream.h"
class date{
private:
int year;
int month;
int day;
public:
date(int year1,int month1,int day1)
{
year=year1;
month=month1;
day=day1;
}
void show_day()
{
cout<<year<<":"<<month<<":"<<day;
}
};
class time{
private:
int hour;
int minute;
int second;
public:
time(int hour1,int minute 1,int second1)
{
hour=hour1;
minute=minute1;
second=second1;
}
void show_time()
{
cout<<hour<<":"<<minute<<":"<<second;
}
};
class datetime:public date,public time
{
public:
void datetime(int year1,int month1,int day1,int hour1,int minute1,int scend1):date(year1,moth1,day1),time(hour1,minute1,scend1)
void show_datetime()
{date::show();
time::show();
}
};
void main()
{
datetime a(2009,12,2,14,2,3);
a.show_datetime();
}