C++ Programming - OOPS Concepts - Discussion
Discussion Forum : OOPS Concepts - General Questions (Q.No. 20)
20.
Which of the following is correct about function overloading?
Discussion:
14 comments Page 1 of 2.
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.
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)
Baru said:
1 decade ago
Function overloading definition it contain same name but different datatype n return type n arguments list.
Vijju said:
1 decade ago
It may or may not different in the return type.
SALEHA said:
1 decade ago
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:
1 decade ago
Overloading is nothing but same function with different arguments.
Roopesh said:
1 decade ago
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.
So the name will be same. But the data types and number of arguments may vary.
Gunvant said:
1 decade ago
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:
1 decade ago
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:
1 decade ago
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)
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:
10 years ago
How is argument different?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers