class RefCountedPart: public RefCounted { public: RefCountedPart(RefCounted const* pParent): m_pParent(pParent) {}; RefCountedPart(RefCountedPart const& another): m_pParent(NULL) {}; RefCountedPart& operator=(RefCountedPart const& another) { return *this; }; private: RefCounted const* m_pParent; virtual void AddRef() const { if (m_pParent) { m_pParent->AddRef(); } else { RefCounted::AddRef(); } } virtual void Release() const { if (m_pParent) { m_pParent->Release(); } else { RefCounted::Release(); } } };