Consider the following program segment and answer the questions. 1 Time getTime
ID: 3866175 • Letter: C
Question
Consider the following program segment and answer the questions. 1 Time getTime () ( 2 Time *myTime = new Time (3, 0, 0), 3 return *myTime, 4 } Modify the function definition to support return-by-reference. Modify the function definition to support return-by-reference using pointer. Modify the function definition to support return-by-value Modify the function definition to support return-by-reference via a parameter. Modify the function definition to support return-by-reference using pointer via a parameter.Explanation / Answer
Answer to 2(c):
Function defination: int getTime()
Please note: You only need to modify the function defination to write the answers and not the function body
Answer to 2(d):
Function defination would be int &getTime()
Answer to 2(e):
Function defination would be int *getTime()
In all the above answers, int supoort the return of integer values or parameter values and & supports return by reference and * supports return by reference via pointers
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.