-
Help Experts!
Why the compile error? WorkCodes is CArray of CWorkCode. ERROR READS "afxtempl.h(443) : error C2582: 'CWorkCode' : 'operator =' function is unavailable" Would appreciate any help! Thanks!
void CTimeView::OnEditAddEdit()
{
CTimeDoc* pDoc = GetDocument();
CWorkCodeDialog wcd;
wcd.DoModal();
CWorkCode wc(wcd.m_strWorkCode, wcd.m_strDescription);
pDoc->WorkCodes.Add(wc);<-------COMPILE ERROR!
}
-
Re: Help Experts!
CArray::Add requires the added type to have an assignment operator
You need to provide at least a copy constructor and an assignment operator in your class if you are storing it by value.
Dave
-
Re: Help Experts!
You need to specify a copyconstructor. When you declare an non-pointer array, then the array stores a copy of the element.
If you don't want to create a copyconstructor, then you have to make an array of pointers to your class.
-
Dave, Thanks very much!
-
Franky, thanks a bunch!