更多"有如下类声明: class SAMPLE int n; "的相关试题:
[单项选择]有如下类声明:
class SAMPLE
int n;
public:
SAMPLE(int i=0):n(i)
void setValue(mt nO);
;
下列关于setValue成员函数的实现中,正确的是
A. SAMPLE::setValue(int nO)n=nO;
B. void SAMPLE::setValue(int nO)n=nO;
C. void setValue(int nO)n=nO;
D. setValue(int nO)n=nO;
[单项选择]有如下类声明:class SAMPLE{ int n; public: SAMPLE(int i=0):n(i){} void setValue(int n(0);};下列关于getValue 成员函数的实现中,正确的是( )。
A. SAMPLE:: setValue(int n0){ n=n0; )
B. void SAMPLE:: setValue(int n0){ n=n0;}
C. void setValue (int n0){ n=n0;}
D. setValue(int n0){ n=n0;}
[单项选择]有如下类声明:
class SAMPLE int n;
public:
SAMPLE(int i=0):n(i)
void setValue(int n(0);
;
下列关于getValue 成员函数的实现中,正确的是( )。
A. SAMPLE:: setValue(int n0) n=n0; )
B. void SAMPLE:: setValue(int n0) n=n0;
C. void setValue (int n0) n=n0;
D. setValue(int n0) n=n0;
[单项选择]有如下类声明;
class SAMPLE
int n;
public:
SAMPLE(int i=0):n(i)
void setValue(int n0);
;
下列关于setValue成员函数的实现中,正确的是( )。
[单项选择]在下面的类定义中,错误的语句是( )。
class Sample
public:
Sample(int val): //①
~Sample( ); //②
private:
int a=2.5; //③
Sample( ): //④
;
A. ①②③④
B. ②
C. ③
D. ①②⑨
[单项选择]有如下类声明: class XA { int x; public: XA(int n) {x=n;} }; class XB: public XA{ int y; public: XB(int a,int b); };在构造函数XB的下列定义中,正确的是______。
A. XB:: XB(int a, int :x(,y( { }
B. XB::XB(int a, int :XA(,y({}
C. XB::XB(int a,int :x(,XB(i}
D. XB::XB(int a,int :XA(,XB({}
[单项选择]有如下类声明: class TestClass int i; private:int j; protected:int k; public:int m,n; 其中,私有成员的数量为( )。
A. 0
B. 1
C. 2
D. 3
[单项选择]有如下类声明: class Foo{int bar;}; 则Foo类的成员bar是
A. 公有数据成员
B. 公有成员函数
C. 私有数据成员
D. 私有成员函数
[单项选择]有如下类声明:
class TestClass
int n;
public:
TestClass(int i=0):n(i)
void setValue(int n0);
;
下面关于setValue成员函数的实现中,正确的是( )。
A. TestClass::setValue(int n0)n=n0;)
B. void TestClass::setValue(int n0)n=n0;
C. void setValue(int n0)n=n0;
D. setValue(int n0)n=n0;