Logical Error

Pages: 123
Thanks sohguanh, Sincerely.
The key concern is about "String" in "accounts", and also "Array" in "names".

"accounts" and "names" are the members of class "Bank", but not for any object from "String" and "Array". So in the copy constructor, I think all memories of "String" and "Array" will follow the copying to the next "bank".

So it's back to the initial question: do accounts or names need to be copied to next bank?
If yes, the data structure of accounts, names and String, Array better to be changed to keep their independency, and then fully and deeply copy become possible.
If no, the existing of the current copy constructor becomes meaningless.

Through reading the codes, the crush not only will happen when deconstructing "String", also even if "String" is not curshing, the crush could also happen when deconstructing of "Array" then.

So, I think better to redesign the data structure of bank.

Some suggestiongs:
1, using STL if possible
2, avoiding heavily using of operator overloading
3, if possible, avoiding using "new" and "delete" directly, keep memory managment in mind.
I don't understand your argument. What's wrong with my String and Array classes?
Topic archived. No new replies allowed.
Pages: 123