3.1类的声明及定义 STRING::~STRING( ifs==0)return;//去掉本行,s1析构两次 cout<<"DECONSTRUCT:"<<s; ■ free(s);s=0; //在析构后置析构标志 ■ void main(void) STRING s1("String varible 1\n"); STRING s2("String varible 2\n"); STRING("Constant\n"); cout<<"RETURN\n";3.1 类的声明及定义 STRING::~STRING( ){ if(s==0) return; //去掉本行,s1析构两次 cout<<"DECONSTRUCT: "<<s; free(s); s=0; //在析构后置析构标志 } void main(void){ STRING s1("String varible 1\n"); STRING s2("String varible 2\n"); STRING("Constant\n"); cout<< "RETURN\n"; }