填空题

下列程序中声明了两个类AA和BB,其中函数“print”是类AA的成员函数,但是类BB的友元函数。 请在①、②和⑧处各填入正确的内容,使程序能正常运行。 #include<iostream.h> [12] ; class AA{ int t; public: AA(int x){t=x;} void print(BB &b) ; }; class BB{ int s; public: BB(int y){s=y;} friend void [13] print(BB &); }; void [14] { cout<<"AA:"<<t<<"BB: "<<w.s<<end1;}< void main(){ AA m(6); BB n(8); m.print(n); } 输出结果为:AA:6;BB:8

【参考答案】

[12]class BB; [13] AA:: [14] AA::print(BB &w)