Is the following snippet of code valid?
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?
}
};