单项选择题

有如下类定义:
class Test

public :
Test() a = 0; c = 0; //①
int f(int a) const this->a = a; //②
static int g() return a; //③
void h(int b) Test::b = b; ;//④
private :
int a ;
static int b;
const int c;
;
int Test::b = 0;
在标注号码的行中,能被正确编译的是( )。

A) ①
B) ②

C) ③

D) ④
<上一题 目录 下一题>
热门 试题

单项选择题
有如下程序: #include < iostream > using namespace std; class A public : A() cout<< A ; ~A() t cout<< ~A ; ; class B : public A A* p; public : B() cout<< B ; p = new A(); B() cout<< ~B ; deletep; ; int main() B obj; return 0 ; 执行这个程序的输出结果是( )。
A) BAA~A~B~A


B) ABA~B~A~A
C) BAA~B~A~A

D) ABA~A~B~A
单项选择题
有如下类定义: class Point int xx, yy; public : Point() : xx(0), yy(0) Point( int x, int y =0) : xx(x), yy(y) ; Point a(2), b[3], *c[4]; 则Point类的构造函数呗调用的次数是( )。
A) 2次
B) 3次

C) 4次

D) 5次
相关试题
  • 模板对类型的参数化提供了很好的支持,因此...
  • 要建立文件流并打开当前目录下的文件file....
  • 有如下程序: #include < iostream ...
  • 有如下函数模板: template < typename...
  • 当使用ifstream流类定义一个流对象并打开一...