指向常对象的指针问题
#include<iostream>using namespace std;
class Student
{
public:
Student(int n,float s)
{
num=n;
score=s;
}
void change(int m,float s)
{
num=m;
score=s;
}
void display(Student)
{
cout<<num<<";"<<score<<endl;
}
private:
int num;
float score;
};
int main()
{
const Student st(34,35.3);
const Student * p=&st;
p->display();
p->change(45,35.7);
p->display();
return 0;
}
//这个程序哪里哟问题?
[ 本帖最后由 赤男 于 2010-9-5 07:56 编辑 ]