单选题
C++
题号 #2255354
有如下程序:
#include<iostream>
usingnamespacestd;
classPair{
intm,n;
public;
Pair(intj,intk):m(j),n(k){}
intget(){returnm;}
intget()const{returnm+n;}
};
intmain(){
Paira(3,5);
constPairb(3,5);
cout<<a.get()<<b.get();
return0;
}
运行时的输出结果是( )。
参考答案
B
答案解析
B。【解析】eonst函数只能被eonst对象调用,a.get()函数调用的返回值是3,而b.get()调用的返回值是8。
你可能感兴趣的试题
A.10
B.16
C.26
D.36
A.5
B.6
C.7
D.8
A.5
B.7
C.9
D.12