• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

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

Which of the following overloaded functions are NOT allowed in C++? 1) Function declarations that differ only in the return type
    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

Please comment below if you find anything wrong in the above post
Feeling lost in the world of random DSA topics, wasting time without progress? It's time for a change! Join our DSA course, where we'll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 geeks!

Last Updated :
Share your thoughts in the comments