ignore the careless mistakes. in the book it said the output is
6
0
9
destructor
destrcutor
destructor.
why? how come?
i want to know why joke.getvalue(3) will have an output, becuase techically it's getting the forth column which is not even there in the program.
And one more question.
let's say i initialize the obejcts as follow(ax,bx,cx)
a)first object, 1 and 2
b)second object. -49
c)third object 11,11,11
d)4th object 0,0,0.
Funny objs[4] {funny(1,2), -49, Funny(11,11,11)}//i don't need to decalre the fourth object since it's 0 0 and 0 it's default anywayz.
write a code to output the third value in the fourth object of the arrey after updating the secound value in the third object by 23. What value would be displayed?
joke.getvalue(3) is saying pass the argument '3' to the member function "getValue", getValue then assigns the argument to 'choice' and runs it through it's body. When it comes to elseif (choice == 3) return ax; on line 19 it returns ax like it's supposed to. If you changed the code so that the function was called "HamSandwich" it would do the same thing, and that is what the book is trying to show you.
i edit my post with a new question can you asnwer it for me?i have the solution but the solution doesn't make sense (it somehow say 11, 11+23,11, which i thought is changing 11 to 23 in second value)so i want some expert to show me.