fgo理想都市:高手帮帮忙吧 这些C++问题不解决我就完了

来源:百度文库 编辑:高考问答 时间:2024/05/13 06:55:39
5.在下面程序横线处填上适当的内容,完成该程序。
class base{
protected:
int a;
public:
base () {a=0;}
base (int i) {a=i;}
base (base&b) {a=b.a;}
};
class derived: public base {
private:
int d;
public:
derived () {d=0;}
derived (int i, int j) :______ {d=j;}
derived (derived&b):__ base(b.a)__ {d=b.d;}
};
6.在下面程序的底画线处填上适当的字句,使该程序执行结果为100。
# include <iostream.h>
class base{int X;
public:
void init(int initX){X=initX; }
int Getnum() {return X+7; }
};
void main()
{_______
________
cout<<test.Getnum();
}

6。base test;
test.init(93);

5。