error:不能引用Watch的默认构造函数,它是已经删除的函数?
#include<iostream> #include<stdlib.h> #include<string> using namespace std; class Watch; class Time { friend Watch; public: Time(int h, int m, int s) { hour = h; minute = m; second = s; } private: int hour; int minute; int second; }; class Watch { public: void print() { cout << t.hour << ":" << t.minute << ":" << t.second << endl; } private: Time t; }; int main() { Time time(7, 8, 55); Watch w;//这里出现了问题 w.print(); system("pause"); return 0; }