The answer is yes.
You can add a virtual method that produces a copy of the object, and returns a pointer type, of the base class. You'll have to write this method for every derived class.
class CBase
{
public:
virtual CBase * MakeCopy(void) const { return new CBase(*this); }
public:
CBase() {}
CBase(const CBase & rhs) {}
virtual ~CBase()
};
class CDerived : CBase
{
public:
virtual CBase * MakeCopy(void) const { return (CBase *) new CDerived(*this); }
public:
CDerived() {}
CDerived(const CDerived & rhs) : CBase(*(CBase *) this) {}
virtual ~CDerived()
};
But you're right, you can't pass the object by value, to a type it's derived from without slicing.