Multiple choice

Function overloading: static polymorphism is achieved by function overloading. Which of the following is not allowed in function overloading?

  1. Same function name with different number of arguments

  2. Same function name with different return type

  3. Same function name with different sequence of arguments

  4. Same function name with different types of arguments

  5. All of the above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Function overloading doesn’t uses the return type for identification of function, so option 2 is correct, e.g. int fun(int ,int);double fun(int,double); is not allowed in function overloading.