#include "iostream"
using namespace std;
class cat
{
public:
cat(){itsage=1;itsweight=5;}
~cat(){cout<<" 析构函数 "<<endl;}
int getage() const{return itsage;}
int getweight()const {return itsweight;}
void setage(int age){itsage=age;}
private:
int itsage,itsweight;
};
void main()
{
cat * family = new cat[5];
cout<<family<<endl;
cout<<family[1]<<endl; //毛病出在这一行,具体语法应该怎么写
delete [] family;
}
这里面有错误,请帮忙改正。并且手动输出5个对象的地址。不要用循环