C++ Programming - Functions - Discussion
Discussion Forum : Functions - General Questions (Q.No. 3)
3.
Which of the following statement is correct?
Discussion:
16 comments Page 2 of 2.
Pankaj sharma said:
1 decade ago
void fun(int a=10,int b=20);
void fun();
main()
{
fun();
}
Ambiguous situation so error.
void fun();
main()
{
fun();
}
Ambiguous situation so error.
Kapil makwana said:
1 decade ago
void fun(int a=10,int b=20);
void fun();
main()
{
fun();
}
Which function will be called in main() first or second?
void fun();
main()
{
fun();
}
Which function will be called in main() first or second?
Pradhnya said:
9 years ago
I think option B is the correct answer.
Pradnya said:
9 years ago
@Pradhnya.
Only option c is correct answer because it says//*All arguments of an overloaded function "CAN BE " default*// means that It does not matter weather the parameter is default or not.
Only option c is correct answer because it says//*All arguments of an overloaded function "CAN BE " default*// means that It does not matter weather the parameter is default or not.
Vignesh mahendran said:
8 years ago
void fun(int a=10,int b=20);
void fun();
main()
{
fun();
}
So, error will occur.
void fun();
main()
{
fun();
}
So, error will occur.
Pavi said:
2 months ago
I think option B is correct because the overloaded function is executed based on the parameters given in the function call.
If we give default arguments means the compiler must be confused about executing the function.
If we give default arguments means the compiler must be confused about executing the function.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers