A-A+

有如下类定义;class AA{int a;public:int getRef()const

2022-08-05 23:24:01 问答库 阅读 173 次

问题详情

有如下类定义;
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; )//④};
其中的四个函数定义中正确的是()。
A.①
B.②
C.③
D.④请帮忙给出正确答案和分析,谢谢!

参考答案

正确答案:B

考点:定义