在C++中,當按值傳遞對象時,複製發生時是否存在限制? 我有以下代碼(簡化): class A;
class Parent
{
public:
void doSomething(std::auto_ptr<A> a); // meant to transfer ownership.
};
std::auto_ptr<A> a = ...;
a->getParent()->d
可以說我有一個基類和派生類: class Base
{
public:
virtual ~Base() {}
virtual void DoSomething() = 0;
};
class Child : public Base
{
public:
virtual void DoSomething()
{