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
Revan
Revan2y ago
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
sigma
sigma2y ago
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?
Revan
Revan2y ago
Display N is the profs code
Revan
Revan2y ago
dellacote does this
Revan
Revan2y ago
when a user adds a number its supposed to appened to the list of doubles
Revan
Revan2y ago
but my program just wipes out the list and just adds the number 123 i dont want it to do that
sigma
sigma2y ago
How are you sure that the problem is within the copy constructor? Are you using a debugger to trace the value of the object?
Revan
Revan2y ago
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