Why is my program jumping into the copy constructor and wiping out my data?
I found a bug where when a function called Displaylist(N) is called it wipes goes into the copy constructor and wipes out my data. How would i change my copy constructor to not do that?
8 Replies
ok so i know my program is supposed to go into the copy contructor
but the workshop says im supposed to the object to a safe empty state
I got a couple of questions.
- Is the displayList(N) part of your code or part of the prof's code?
- What does deallocate do? Could you show a short snippet?
- What do you mean that it wipes out your data? Do you mean that it clears the data for all the objects?
Display N is the profs code
dellacote does this
when a user adds a number its supposed to appened to the list of doubles
but my program just wipes out the list
and just adds the number 123
i dont want it to do that
How are you sure that the problem is within the copy constructor?
Are you using a debugger to trace the value of the object?
yeah i traced the value and it gets wiped in the copy contructor
im an idiot i forgot to copy over one of the values thats why it doesnt work