🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: References and Functions: all 10 questions

Quiz: References and Functions · Question 9 of 10

Can two overloaded functions differ only in their return type, like int get() and double get()?

Can two overloaded functions differ only in their return type, like int get() and double get()?

  1. A.Yes, the compiler picks by the variable you store into
  2. B.No, overloads must differ in their parameter lists
  3. C.Yes, but only for inline functions
  4. D.Only if one of them is const
Answer & explanation

Correct answer: No, overloads must differ in their parameter lists

The call get() looks the same for both, so the compiler could not choose.

Can you get the rest right without peeking?

Take the timed Quiz: References and Functions quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →