|
-
April 21st, 1999, 12:50 AM
#1
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!
}
-
April 21st, 1999, 04:20 AM
#2
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
-
April 21st, 1999, 04:27 AM
#3
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.
-
April 21st, 1999, 07:29 AM
#4
-
April 21st, 1999, 07:33 AM
#5
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|