#include
#include
using namespace std;
class Date;
class Time
{
private:
int hour;
int minute;
int sec;
public:
Time(int h, int m, int s) :hour(h), minute(m), sec(s){}
friend void display(Time & , Date & );
};
class Date
{
private:
int month;
int day;
int year;
public:
Date(int h, int m, int s) :month(h), day(m), year(s){}
friend void display(Time &, Date &);
};
void dispaly(Time & t, Date & d)
{
cout << d.month << "/" << d.day << "/" << d.year << endl;
cout << t.hour << ":" << t.minute << ":" << t.sec << endl;
}
void main()
{
Time t1(12, 13, 14);
Date d1(6, 12, 2016);
dispaly(t1, d1);
system("pause");
}
我暈,看了好久沒看出問題來
後來發現是void dispaly(Time & t, Date & d)中的dispaly拼錯了,應該是display