有如下程序:#include<iostream>using namespace std;class A{public:A(int i):r1(i){}void
15 查阅
有如下程序:
#include<iostream>
using namespace std;
class A{
public:
A(int i):r1(i){}
void print(){cout<<‘E’<<rl<<‘-’;}
void print()const{cout<<‘C’<<rl*rl<<‘-’;}
private:
int rl:
};
int main(){
A a1(2); const A a2(4);
a1.print(); a2.print();
return 0;
}
运行时的输出结果是
A.运行时出错
B.E2-C16-
C.C4-C16-
D.E2-E4-
参考答案: