有以下类定义:class Point{int x_,y_;Public:Point (): x_(0), y_(0){}Point ( int x, int y =0);x_(x), y _(y){}};若执行语句:Point a(2), b[3],* c[4];则 Point 类的构造函数被调用的次数是( )
查看答案
有以下类定义: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. ④
若有以下类声明class MyClass{public :MyClass (){ cout <<1; }};执行下列语句MyClass a , b[2],* P[2];程序的输出结果是( )
A. 11
B. 111
C. 1111
D. 11111
有以下程序:# include < iostream >using namespace std ;class A{Public:static int a;void init(){a=1;}A(int a=2){init();a++;}};int A::a=0;A obj;int main(){cout<
A. 0
B. 1
C. 2
D. 3
有以下程序# include < iostream >using namespace std ;class MyClass{public :MyClass (){ cout <" A ";}MyClass ( char c ){ cout < c ;}~ MyClass (){ cout <<" B ";}};int main (){MyClass pl ,*p2;p2= new MyClass (' X ');delete p2;return 0;}执行这个程序,计算机屏幕上将显示输出()
ABX
B. ABXB
C. AXB
D. AXBB