C++ Programming - OOPS Concepts - Discussion

Discussion :: OOPS Concepts - General Questions (Q.No.20)

20. 

Which of the following is correct about function overloading?

[A]. The types of arguments are different.
[B]. The order of argument is different.
[C]. The number of argument is same.
[D]. Both A and B.

Answer: Option D

Explanation:

No answer description available for this question.

Baru said: (Dec 20, 2012)  
Function overloading definition it contain same name but different datatype n return type n arguments list.

Vijju said: (Apr 18, 2013)  
It may or may not different in the return type.

Saleha said: (May 4, 2013)  
In function overloading function has same name but accessing depends on the no. And type of arguments so, answer is option A & B.

Sangee said: (Jul 30, 2014)  
Overloading is nothing but same function with different arguments.

Roopesh said: (Nov 14, 2014)  
Function overloading means using the same function to perform different tasks.

So the name will be same. But the data types and number of arguments may vary.

Gunvant said: (Jan 9, 2015)  
C++ allows you to specify more than one definition for a function name or an operator in the same scope, which is called function overloading and operator overloading respectively.

Mphatso said: (Jun 24, 2015)  
Function overload can have the same number of argument but different of different types. So I think the correct answer should be A, B, C.

Viranshukumar said: (Aug 22, 2015)  
Option B is not correct because :

int fun (int a, int b, int c)

Here I change the order or arguments.

int fun (int b, int c, int a)

Varun Aggarwal said: (Oct 23, 2015)  
How is argument different?

Gelu Menumorut said: (Aug 11, 2016)  
First, the arguments don't count here, only the parameters count.

Then, the order of the parameters doesn't count if their type is the same, so 'B' doesn't apply.

In case the types are different and their order is different, that means different parameters' types so this case is covered by 'A'.

Smarty said: (Dec 30, 2016)  
Please explain it with an example.

Balaji said: (Jul 11, 2017)  
What is meant by order of arguments?

Vrushabh said: (Jul 18, 2017)  
int foo(int a,float b){ } and int foo(float a,int b){} are different.

This shows function arguments order difference.

Ahmed Redha said: (May 25, 2019)  
Two functions are overloaded if they have the same name but different arguments (parameter list).

Two parameter lists are different if :

1) They have a different number of arguments.
2) They have the same number of arguments but differ in the type of one argument at least.
3) They have the same number of arguments and data types but with a different order.

@Viranshukumar.

The example which you given is not correct since all arguments have the same type so the order is meaningless.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.