下面函数声明类comp,用友元函数重载运算符"+"。[1] comp {public:int real,imag;comp(int r=0,int i=0){real=r;imag=i;}friend comp operator +(comp &,comp &);};Comp [2]{ int r,i;[3] ;i=x.imag+y.imag;return comp(r,i);}
A为抽象类,输出为:this is class B printingthis is class C printing源程序为:#include using namespace std;class A {public:[1] ;};class B :public A {public:void printMe() { [2] <<"this is class B printing"<
写程序运行结果#include using namespace std;class Base{public:virtual ~Base(){cout<<”Base Destructor”<fun();delete p;return 0;}
请改正程序中的错误,使程序的输出结果如下:Base0 displayBase1 displayDerived display注意:(1)只修改注释的下一行,不要改动程序中的其它内容,也不允许增加或删减语句。(2)答题时注明错误的编号,并写出修改后完整的一行。#include using namespace std;class Base0{public:/************Error found [1] ************/void display(){cout<<”Base0 display”<