Question discussion

Which of the following pairs of function declarations CANNOT coexist as overloaded functions in the same scope in C++?

2380Medium DSSSB TGT Computer Science 0 replies 1 views
0

Which of the following pairs of function declarations CANNOT coexist as overloaded functions in the same scope in C++?

  • Avoid f(int); void f(char);
  • Bint f(int); int f(double);
  • Cint f(int); int f(int, int);
  • Dint f(int); double f(int);
Correct answer: D

Explanation

Overloaded functions must differ in the number or the types of their parameters; a difference in the return type alone is not enough.

Discussion 0

Nobody has replied yet. Start the discussion!