当前位置:编程学习 > C/C++ >>

C++程序设计

class String { friend ostream & operator<<(ostream & output,const String & string); public: String(const char * =""); String(const String &); ~String(); private: int length; char *sptr; void setString(const char *); }; String ::~String() { cout<<"ha."<<endl; delete [] sptr; } 对于String类,为什么调用折构函数后会会出现一个对话框(debug library)??
追问:的确,我把delete[] sptr;删了以后,就行了。但是我还是不理解为为什么?
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,