有如下程序:    #include<iostream>    using namespace std;    class AA    {        int n;        public:        AA(int k);n(k){}      

admin2017-10-17  22

问题 有如下程序:    #include<iostream>    using namespace std;    class AA    {        int n;        public:        AA(int k);n(k){}        intget(){return n;}        int get()const{return n+1;}    };    int main()    {        AA a(5);        const AA b(6);        cout<<a.get()<<b.get();        return 0;    }    执行后的输出结果是

选项 A、55
B、57
C、75
D、77

答案B

解析 本题考查const对象。一个const对象只允许被声明为const的方法函数引用。
转载请注明原文地址:https://kaotiyun.com/show/mXAp777K
0

最新回复(0)