我对这段代码有疑问...为什么它一直访问会员复印机
这是代码,这是一个名为 的类的成员函数string
。
string operator +(string &r) {
char *k = NULL;
k = new char[strlen(this->getstring()) + strlen(r.getstring()) + 1];
strcpy(k, this->getstring());
strcat(k, r.getstring());
string Z = k;
delete[] k;
return Z; // visits MemberWise Copier then destructs..
}
这是我的会员复印机..
string(string &p) : s(NULL)
{
setstring(p.getstring());
}