Quote:
Originally Posted by tyler_cracker
oh and let me be the first to add LOLMFC.
I dont think mfc is that horrible but I dont have any experience developing larger applications in another language... Just small school projects.
That said, I ended up storing all the objects in a CArray. Well I tried to.
When I did that i kept getting the error i posted above about not being able to access private members.
The reason for this was I had
Code:
Class myclass
{
nonrelevantmemberfunctions();
CArray myarray;
}
When I tried to add myclass to my array of classes it was trying to do a copy of the CArray myarray object.
After some playing around I found that
Code:
CArray array1;
CArray array2;
array1 = array2; //This causes the same error -> no copy constructor
so basically I have to write a copy constructor for myclass that uses
Code:
array2.RemoveAll();
for (int i=0; i < array1.GetCount(); i++)
array2.Add(array1.GetAt(i));
Which seems like it will work when I implement it in all my code.
I guess whenever I write a class now I know I need the copy constructor if I have dynamic memory, makes sense mostly.
Though it does seem odd they CArrays don't have the ability to copy by default.
Yeah, I do like the idea of having other people look at code at least to see if they can understand it. I really wish we were a bigger company so I can learn and grow more but I actually do like my job.