My code builds fine but I'm getting the error: Unhandled exception at 0x00413b62 in Tenta_1_del_3.exe: 0xC0000005: Access violation reading location 0xfeeefeee when I'm running it in debug-mode.
My constructors, destructors, copyconstructor and overloaded assignment operator should be correct so I have no idea why this happens.
I would very much appreciate if someone could take a look at my code below cause my teacher couldn't help me. He had no idea!
There's something about a bad pointer, that's all I've figured out.
(There's two more files I haven't uploaded here (MoneyBox.h and .cpp) but they should be fine. The problem must be in MoneyBoxHandler)
this->moneyBoxes[i] = new MoneyBox(*(obj.moneyBoxes[i]);
Otherwise you will just be copying the pointers--- this is probably not what you want, else you will delete your money boxes twice when your handlers go out of scope. This is probably what causes your error, fix that and tell me if something is still wrong.
Oh btw: In your assignment operator, delete your moneyboxes instead of just setting them to NULL, else you will leak memory here.