Click to See Complete Forum and Search --> : Help Experts!


Johnny DeMichael
April 21st, 1999, 12:50 AM
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!

}

Dave Lorde
April 21st, 1999, 04:20 AM
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

Franky Braem
April 21st, 1999, 04:27 AM
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.

Johnny DeMichael
April 21st, 1999, 07:29 AM
eom

Johnny DeMichael
April 21st, 1999, 07:33 AM
eom