Hi all, super noobish question here. My instructions say I have to take the values of the objects below and convert them to a string in the method "string toString()", that I can then display via method "display()".
I'm having a really hard time transferring either the values or a string outside of the class to be accessed by main, ultimately.
Sorry for the poorly worded question, I've been coding for 6 weeks now. Thanks in advance for any advice!
I'm sorry if this is too much code. I tried to cut a lot out... The last two methods are where my question is.
You never call toString() anywhere so theString never gets set. I don' think you want theString to be member variable of the class. Why not make theString a local variable in the toString function instead and then you can call toString() in the display function to get the string representation of the object?
I didnt include the temp2 variable for my own assumptions,but you can try this to see it it works. 😃
Also,there will be a '+' sign before temp2 in line138.remember tht.
As for this line,
I'm having a really hard time transferring either the values or a string outside of the class to be accessed by main, ultimately
That's incredibly helpful, Peter87 and MaBunny, and I thank you both! I was able to get it to display something because of the two of you! It's not displaying what I want yet, and I don't know why, but I'm so much closer!