【发布时间】:2011-04-28 14:50:22
【问题描述】:
下面的sn-p代码有效吗?
class Foo
{
public:
int a;
SomeClass* pb;
Foo() {...}
Foo(const Foo& rhs)
{
this->a = rhs.a;
memcpy(this->pb, rhs.pb, sizeof(SomeClass));
}
~Request()
{
delete this->pb; // Suppose pb is a result of copy constructor,
// Is this valid or is there a better way?
}
};
【问题讨论】: