The above code is giving the compilation error as below: 1>C:\Win16App\VisualStudio2005\VC\atlmfc\include\afxtempl.h(1339) : error C2248: 'CObject::operator =' : cannot access private member declared in class 'CObject'
1> C:\Win16App\VisualStudio2005\VC\atlmfc\include\afx.h(559) : see declaration of 'CObject::operator ='
1> C:\Win16App\VisualStudio2005\VC\atlmfc\include\afx.h(529) : see declaration of 'CObject'
1> This diagnostic occurred in the compiler generated function 'CMap<KEY,ARG_KEY,VALUE,ARG_VALUE> &CMap<KEY,ARG_KEY,VALUE,ARG_VALUE>::operator =(const CMap<KEY,ARG_KEY,VALUE,ARG_VALUE> &)'
1> ARG_KEY=CString &,
1> ARG_VALUE=CString &
Can any body help me what is the reason behind this and how can I fix this?
I cannot believe that the above code by itself is giving you this error.
CString is not derived from CObject. Are you perhaps trying to use operator = on your SConfig struct? If so, you are running into the fact that CMap is not copyable or assignable, because the base class CObject is not.
I would strongly recommend you to use std::map rather than CMap. It is copyable, assignable, generally better designed, and portable. Superior in every imaginable way, IMHO.