Are you dynamically allocating memory for your barray
array?
If so, you will need to make sure that ba2's array is large enough to hold all the data in ba1's array before you start copying the data over.
If it's not, you will need to reallocate the array so that it's big enough.
BitArray ba2 = ba1;
calls the copy constructor, not the assignment operator.
To clarify:
1 2
|
MyClass inst2 = inst1; //copy ctor
inst2 = inst1; //operator=
|
Last edited on