有如下类定义: 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;}; //④ private: int a; static int b; const int C; }; int Test::b=0; 在标注号码的行中,能被正确编译的是( )。
A.①
B.②
C.③
D.④
第1题:
有如下类定义: class Test { public: Test{a=0;c=0;}//① int f(im A.const{this->a=a;}//② static int g{return a;f//③ void h(int B.{Test:.b=b;};//④ private: int a; static int b; const int C; }; int Test::b=0: 在标注号码的行中,能被正确编译的是( )。
A.①
B.②
C.③
D.④
第2题:
已知程序中已经定义了函数test,其原型是int test (int,int,int);,则下列重载形式中正确的是( )。
A.char test(int, int, int);
B.double test (int,int,double);
C.int test(int ,int, int=0);
D.float test(int,int,float=3.5F);
第3题:
第4题:
有如下类定义: class Test { int x_,y_; public: Test ():a_(0) ,b_(0) {} Test(int a,int b=0) :a_(a),b_(b){} }; 若执行语句 Test x(2) ,y[3],*z[4]; 则Test类的构造函数被调用的次数是( )。
A.2次
B.3次
C.4次
D.5次
第5题:
如下程序编译时发生错误,错误的原因是show函数实现语句错误,则正确的语句应该为______。
include<iostream.h>
class test
{
private:
int hum;
public:
test(int);
void show( );
};
test::test(int n){num=n;}
test::show( ){cout<<num<<endl;}
void main( )
{
test T(10):
T.show( );
}