单项选择题
根据下面的程序,可以在主程序中使用的合法语句是( )。 #include <iostream> using namespace std; class Person{ int age; voidtest(){} public: Person(intage){this->age=age;} void ShowAge(){cout<<"the Person’s age is",<<age;} }; void main(){ Person wang(23); }
A.wanage=45
B.wanwang(45)
C.wanShowAge()
D.wantest()
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
下面程序输出的结果是( )。 #include<iostream> using namespace std; class A{ int X; public: A(int x):x(++x){} ~A(){cout<<x;} }; class B:public A{ int y; public: B(int y):A(y),y(y){} ~B(){cout<<y;}; }; void main(){ B b(3); }
A.34
B.43
C.33
D.44
点击查看答案&解析
单项选择题
应在下面程序下划线中填写的正确的语句是( )。 #include <iostream> using namespace std; class A{ public: void test(){cout<< this is A! ;} }; class B:public A{ void test(){ ______ 显示调用基类函数test() cout<< this is B! ; } }; void main(){}
A.A::test()
B.test()
C.B::test()
D.this->test()
点击查看答案&解析
相关试题
根据下面的程序,可以在主程序中使用的合法...