Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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