[单选题]

有如下类定义: 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类的构造函数被调用的次数是

A.2次

B.3次

C.4次

D.5次

参考答案与解析:

相关试题

有如下类定义:class Point{int x_, y_;public:Poi

[单选题]有如下类定义: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 类的构造函数被调用的次数是A. . 2 次B. . 3 次C. . 4 次D. . 5 次

  • 查看答案
  • 有如下类定义:class Point{int x_,y_;public:Poin

    [单选题]有如下类定义: 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类的构造函数被调用的次数是A.2次B.3次C.4次D.5次

  • 查看答案
  • 有如下类定义:class Test{int x_,y_;public:Test

    [单选题]有如下类定义: 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次

  • 查看答案
  • 有如下类定义:class Point{int x__, y__;public:P

    [单选题]有如下类定义: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 类的构造函数被调用的次数是( )。A.2次B.3次C.4次D.5次

  • 查看答案
  • ( 13 )有如下类定义:class XX{int xdata;public:X

    [单选题]( 13 )有如下类定义:class XX{int xdata;public:XX(int n=0) : xdata (n) { }};class YY : public XX{int ydata;public:YY(int m=0, int n=0) : XX(m), ydata(n) { }};YY 类的对象包含的数据成员的个数是A. ) 1B. ) 2C. ) 3D. ) 4

  • 查看答案
  • 有如下类定义: class Point{ private: static int

    [单选题]有如下类定义: class Point{ private: static int how_many; }; ______how_many=0; 要初始化Point类的静态成员how_many,下划线处应填入的内容是A.intB.static intC.int Point: :D.static int Point

  • 查看答案
  • 有如下类定义:class AA{int a;public:int getRef(

    [单选题]有如下类定义:class AA{int a;public:int getRef() const{return &a;} // ①int getvalue() const{return a;} // ②void set(int n) const{a=n;} // ③friend void show(AA aa) const {cout< // ④};其中的四个函数定义中正确的是A. . ①B. . ②C. . ③D. . ④

  • 查看答案
  • 有如下类定义: class AA { int a; public: int ge

    [单选题]有如下类定义: class AA { int a; public: int getRef()const{return &有如下类定义: class AA { int a; public: int getRef()const{return &a;} //① int getValue()const{return a;) //② void set(int n)const{a=n;} //③ friend void show(AAaa)const{cout<<a;} //④ }; 其中的四

  • 查看答案
  • 有如下类定义:class AA{int a;public:int getRef(

    [单选题]有如下类定义: class AA{ int a; public: int getRef( )eonst{return &a;} //① int getValue( )const{return a;} //② vold set(int n)eonst{a=n;} //③ friend void show(AA aA) eonst{tout<<a;} //④ }; 其中的4个函数定义中正确的是A.①B.②C.③D.④

  • 查看答案
  • 有如下类定义: class AA{ int a; public: AA(int

    [单选题]有如下类定义:class AA{int a;public:A.A(int n=0):a(n){}};class BB:public AA{public:B.B(intn)______};其中横线处缺失部分是( )。A.) :a(n){}B.) :AA(n){}C.) {a(n);}D.) {a=n;)A.B.C.D.

  • 查看答案
  • 有如下类定义: class Point { int x_,y_; public: