I can present a couple of possible interpretations:
-, ++ new delete ; , , , .
-, operator=, . , (, Boost shared_ptr), operator=, , . :
template <class T>
class RefCountedPtr {
public:
RefCountedPtr(T *data) : mData(data) { mData->incrRefCount(); }
~RefCountedPtr() { mData->decrRefCount(); }
RefCountedPtr<T>& operator=(const RefCountedPtr<T>& other) {
mData = other.mData;
return *this;
}
...
protected:
T *mData;
};
operator= , mData other.mData: mData, ; other.mData, , , , , .
, operator= , , , , .
, , , , .
EDIT: , , -, . , , , , , , , .