Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

C++ | Function Overloading and Default Arguments | Question 3

  • Last Updated : 28 Jun, 2021

Which of the following overloaded functions are NOT allowed in C++?

1) Function declarations that differ only in the return type

Take a step-up from those "Hello World" programs. Learn to implement data structures like Heap, Stacks, Linked List and many more! Check out our Data Structures in C course to start learning today.
    int fun(int x, int y);
         void fun(int x, int y); 

2) Functions that differ only by static keyword in return type

    int fun(int x, int y);
         static int fun(int x, int y); 

3)Parameter declarations that differ only in a pointer * versus an array []



int fun(int *ptr, int n);
int fun(int ptr[], int n); 

4) Two parameter declarations that differ only in their default arguments

int fun( int x, int y); 
int fun( int x, int y = 10); 

(A) All of the above

(B) All except 2)
(C) All except 1)
(D) All except 2 and 4


Answer: (A)

Explanation: See Function overloading in C++

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :