单选题
C++
题号 #2254964
以下类定义中可能会引起错误的语句是( )。
classA
{
public:
~A( ){}//1
inti;//2
private:
intj;//3
A(inti){i++;}//4
};
参考答案
D
答案解析
D。【解析】本题考查关于C++语言类的定义方法。在C++语言中类定义中的构造函数是私有的,但是却调用了其中的公有变量,在实例化时会斟现错误。
你可能感兴趣的试题
A.funlTestClasslfun2TestClass
B.funlTestClass1fun2TestC1ass1
C.funlTestClassfun2TestClass
D.funlTestClassfun2TestClassl
A.xy
B.yx
C.X
D.y