填空题

在下列的程序的横线处填上适当的语句,使该程序的输出为12。 #include<iostream> using namespace std; class TestClass { public: int a,b; TestClass(int i,int j) { a=i; b=j; } }; class TestClass1:public TestClass { int a; public: TestClass1(int x):TestClass(x,x+1){} void show() { ______;//输出基类数据成员a的值 cout<<b<<endl; } }; int main() { TestClass1 d(1); d.show(); return 0; }

【参考答案】

cout<<TestClass::a
热门 试题

填空题
虚函数必须是类的______。