高等继续教育 / 面向对象程序设计
正确率:100%
以下程序的运行结果是:6,8
#include <iostream>
using namespace std;
class R{
public:
R(int r1, int r2){
R1=r1;R2=r2;
}
void print();
void print() const;
private:
int R1,R2;
};
void R::print(){
cout<<R1<<","<<R2<<endl;
}
void R::print()const{
cout<<R1<<","<<R2<<endl;
}
int main(){
R a(6,8);
const R b(56,88);
b.print();
return 0;
}
对
错
#include <iostream>
using namespace std;
class R{
public:
R(int r1, int r2){
R1=r1;R2=r2;
}
void print();
void print() const;
private:
int R1,R2;
};
void R::print(){
cout<<R1<<","<<R2<<endl;
}
void R::print()const{
cout<<R1<<","<<R2<<endl;
}
int main(){
R a(6,8);
const R b(56,88);
b.print();
return 0;
}
对
错
参考答案: