回a的值,x为该类的一个对象,则访问x对象中数据成员a的格式为(X)。
A)xa
B)xa
C)xGetValue
D)xGetValue
25假定AA为一个类,i
ta为该类的一个成员函数,若该成员函数在类定义体外
定义,则函数头为(A)。
A)i
tAAa
B)i
tAAa
6
6
fC)AAa
D)AAi
ta
26有如下程序:
i
cludeiostream
usi
g
amespacestd
classTest
public
Test
Testcout
i
tmai
Testtemp2pTemp2
retur
0
执行这个程序输出星号()的个数为(B)。
A)1B)2C)3D)4
27有如下程序:
i
cludeiostream
usi
g
amespacestd
classMyClass
public
MyClassi
ti0cout1
MyClassco
stMyClassxcout2
MyClassoperatorco
stMyClassxcout3retur
this
MyClasscout4
i
tmai
MyClassobj11obj22obj3obj1
obj1obj2
retur
0
运行时的输出结果是(A)。
A)1123444B)11114444C)121444D)11314444
28有如下程序:
7
7
fi
cludeiostream
usi
g
amespacestd
classpoi
t
public
statici
t
umber
public
poi
t
umber
poi
t
umber
i
tpoi
t
umber0
voidmai
poi
tptr
poi
tAB
poi
tptr_poi
t
ewpoi
t3
ptrptr_poi
t
poi
tC
deleteptr
coutpoi
t
umber
程序结果为A
A)3B)4C)6D)7
29友元运算符obj被C编译器解释为(D)。
Aoperatorobj
Boperatorobj0
Bobjoperator
Dobjoperator0
二、程序填空
1.用递归法求从1到
的立方和:
f11f
f
1
3
1
1
8
8
fi
cludeiostream
usi
g
amespacestd
i
tfi
t
i
tmai
i
t
s
cout