请在下面程序的横线处填上适当字句,以使程序完整,并使程

请在下面程序的横线处填上适当字句,以使程序完整,并使程序的输出为

A Constructor2

B Constructor2

x1=12

x2=2

#include <iostream.h>
class A
{public:
A(){cout<<"A Constructor1"<<endl;}
A(int i){x1=i;cout<<"A Constructor2"<<endl;};
void dispa(){cout<<"x1="<<x1<<endl;}
private:
int x1;
};
class B:public A
{
public:
B(){cout<<"B Constructor1"<<endl;}
B(int i): _____(1)_____{x2=i;cout<<"B Constructor2"<<endl;}
void dispb()
{_____(2)_____;
cout<<"x2="<<x2<<endl;
}
private:
int x2;
};
int main()
{B b(2);
b.dispb();
}
答案
第1空:A(i+10)
第2空:dispa()

题目信息

题号:7594
题型:填空题
难度:普通