A-A+

有如下类声明:class SAMPLE{ int n; public: SAMPLE(int

2022-08-06 03:40:37 问答库 阅读 175 次

问题详情

有如下类声明: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;}请帮忙给出正确答案和分析,谢谢!

参考答案

正确答案:B

考点:声明