I'm sure that the display member should not modify the contents of the object... so your display function should be called something like corruptAndDisplay()
Printable View
I'm sure that the display member should not modify the contents of the object... so your display function should be called something like corruptAndDisplay()
Im really not getting what u mean? Are u saying that my member functions are changing the contents. Should I use & as like a reference?
I mean the function should do what the name suggests
display function should display current contents and should not modify the object
your function effectively modifies the object - so it is wrong on this state already
declare it as a const and see the compilation errors you get