I created my class CData and derived it from CObject, because I need to serialize it.
class CData : public CObject
{
DECLARE_SERIAL(CData);
public:
CData();
virtual ~CData();
virtual void Serialize(CArchive& ar);
//Data
CString m_strName;
ULONG m_ulID;
CString m_strCorps;
CPoint m_Coordinate;
short m_sStatus;
};
And I use a vector of type vector<CData> in my document class. I add new CData-objects to the vector during the runtime of the program using vecData.push_back(Data) (where Data is of type CData).
But when I try to compile this i get the following error:
error C2248: ‘CObject::CObject’ : cannot access private member
declared in class ‘CObject’
I searched a bit and found out, that it has to do with the CObject-class to be non-copyable or something like this!?!?…
Does anyone know how to solve this problem?
CObjectdeclares the copy constructor asprivate, so you need to implement the copy constructor (and assignment operator overload) for your class yourself. TheCObjectconstructor documentation says:I hope this helps!