头文件中 析构函数出错
class Cat{
public:
cat()//Tom的构造函数
{
// PItsage=new int ();
// PItsweight=new int ();
PItsage=NULL;
PItsweight=NULL;
cout<<"constructing..."<<endl;
return 0;
}
cat(int age,int weight)//有财富猫的构造
{
PItsage=new int (age);
PItsweight=new int (weight);
cout<<"other constructing..."<<endl;
return 0;
}
copycat(Cat &cat1)//引用复制一只与Tom一样的猫
{
PItsage=new int(*(cat1.PItsage));
PItsweight=new int(*(cat1.PItsweight));
cout<<"copy constructing..."<<endl;
return 0;
}
~cat()//析造函数 报错
{
cout<<*PItsage<<endl;
delete(PItsage);
delete(PItsweight);
cout<<"destructing..."<<endl;
return 0;
}
private:
int *PItsage;
int *PItsweight;
}
错误提示:
error: expected class-name before '(' token|