全部题库 / C++ / 试题详情
单选题 C++
2013-08-06

有如下程序:
#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;
}
运行时的输出结果是(  )。

A.33
B.38
C.83
D.88

参考答案

B

答案解析

B。【解析】eonst函数只能被eonst对象调用,a.get()函数调用的返回值是3,而b.get()调用的返回值是8。

你可能感兴趣的试题