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
RevanOP3y 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
sigma3y 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
RevanOP3y ago
Display N is the profs code
Revan
RevanOP3y ago
dellacote does this
Revan
RevanOP3y ago
when a user adds a number its supposed to appened to the list of doubles
Revan
RevanOP3y ago
but my program just wipes out the list and just adds the number 123 i dont want it to do that
sigma
sigma3y 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
RevanOP3y 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
Want results from more Discord servers?
Add your server