填空题 下列程序的输出结果是非曲直{{U}} 【15】 {{/U}}。 #include<iostream, h> class base { int x, y; public: base(int i, int j){x=i; y=j;} virtual int add(){return x+ y;} }; class three: public base { int z; public: three(int i, int j, int k) :base(i, j){z=k; } int add() { return (base:: add()+z); } }; void main() { three * q=new three(lO,20,30); cout<<q->add()<<end1; }
  • 1、
【正确答案】 1、60    
【答案解析】[解析] 本题考察继承中子类对父类的继承方式,注意子类的add成员函数,它直接使用了父类的成员函数进行运算。