为什么输出的结果不正确,请大家看看
#include<iostream>using namespace std;
class Point
{ public:
void set_message(int money,int age)
{ itsmoney=money;
itsage=age;
}
int get_money(int itsmoney)
{ return itsmoney; }
int get_age(int itsage)
{return itsage;}
private:
int itsmoney,itsage;
};
void main()
{ Point *p[3];
int i;
p[0]=new Point;
p[0]->set_message(20,15);
p[1]=new Point;
p[1]->set_message(300,20);
p[2]=new Point;
p[2]->set_message(100,30);
for(i=0;i<3;i++)
{
cout<<p[i]->get_money<<' '<<p[i]->get_age<<endl;
delete p[i];
}
}