C++ Programming - OOPS Concepts - Discussion

Discussion Forum : OOPS Concepts - General Questions (Q.No. 20)
20.
Which of the following is correct about function overloading?
The types of arguments are different.
The order of argument is different.
The number of argument is same.
Both A and B.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
14 comments Page 2 of 2.

Smarty said:   9 years ago
Please explain it with an example.

Balaji said:   8 years ago
What is meant by order of arguments?

VRushabh said:   8 years ago
int foo(int a,float b){ } and int foo(float a,int b){} are different.

This shows function arguments order difference.

Ahmed Redha said:   6 years ago
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.
(2)


Post your comments here:

Your comments will be displayed after verification.