This error often occurs when using classes such as: CArray or CList.
The cause of this error is due to the custom class's array entry
There is an operation like ADD () in this operation, actually need a = operation, but this = operation is not implemented in the custom class, so, the program automatically go to its parent class is the CObject class to find, but found a class of this = is a private then reported this A mistake.
Knowing the cause of the solution is natural, that is, in the custom class overloaded operator = overload after this error is gone.
class Public cobject{public: coptrect (); virtual ~coptrect (); // start range of the Operation CRect m_optstartrect; // end range of the Operation CRect m_optendrect; // Target Interface of the operation int M_optdessurface; Coptrectoperator = (Coptrect & src);};
Implementation code
coptrect::coptrect () : m_optdessurface (0) {}coptrect::~coptrect () {}coptrect & Coptrect::operator = (Coptrect & src) { this->m_optdessurface= Src.m_optdessurface; This->m_optendrect = src.m_optendrect; This->m_optstartrect = src.m_optstartrect; return *this;}
So after implementing this custom class, start using it
Define the array of variables first
Carray<coptrect, coptrect&> Optarray;
After this array, we use a command that adds a new element
// add an action area to the interface void int Desid) { coptrect ort; = Start; = End; = Desid; Optarray.add (ORT);}
After doing so, do not report the above error! Problem solving
VC + + Error C2248: "Cobject::cobject": Cannot access private member (declared in "CObject" Class)