#include <iostream>
using namespace std;
class Smaple {
private:
int n;
public:
int m;
Smaple(int i, int j) {m=i ;n=j ;}
void Setvalue ( int i)const { n=i;}
void Disp() { cout<<"m="<<m<<"\t"<<"n="<<n<<endl;}
};
int main() {
Smaple consta (3,4); //常对象
Smaple b (1,2); //普通对象
a.Setvalue(4); // error
b.Setvalue(5); //error
a.m=30; //error
a.Disp(); //error
b.Disp();
return 0; }
怎么改错大神们!
using namespace std;
class Smaple {
private:
int n;
public:
int m;
Smaple(int i, int j) {m=i ;n=j ;}
void Setvalue ( int i)const { n=i;}
void Disp() { cout<<"m="<<m<<"\t"<<"n="<<n<<endl;}
};
int main() {
Smaple consta (3,4); //常对象
Smaple b (1,2); //普通对象
a.Setvalue(4); // error
b.Setvalue(5); //error
a.m=30; //error
a.Disp(); //error
b.Disp();
return 0; }
怎么改错大神们!