作者在 2014-05-06 22:02:43 发布以下内容
#include<iostream>
using namespace std;
class CPoint
{
public:
CPoint(int x=0,int y=0);
int SetTemp();
void Print();
void Print() const;
private:
int m_x;
const int m_y;
static const int m_z;
int m_temp;
};
void main()
{
const int ARRAY_SIZE=5;
CPoint *pCPoint;
pCPoint=new CPoint[ARRAY_SIZE];
if(pCPoint==NULL)
{
cout<<"动态内存分配失败。\n";
exit(0);
}
for(int iCnt=0;iCnt<ARRAY_SIZE;iCnt++)
{
pCPoint[2].SetTemp();
pCPoint[iCnt].Print();
}
delete[]pCPoint;
pCPoint=NULL;
CTemp *pCTemp=new CTemp(5);
if(pCTemp==NULL)
{
cout<<"动态内存分配失败。\n";
exit(0);
}
delete pCTemp;
}//有个错误·,大家帮我找找