C++ Programming - Functions - Discussion
Discussion Forum : Functions - General Questions (Q.No. 4)
4.
Which of the following statement is correct?
Discussion:
4 comments Page 1 of 1.
Hrudwik said:
7 years ago
Since using const, it must have a default argument. Which against option A.
Hope this helps.
Hope this helps.
Asd said:
8 years ago
Why A is not true? We can overload by using const!
Satya said:
10 years ago
void addition(int a,int b,int c=3, int d=4);
void addition(int,int); Not allowed by the compiler.
Why do you need the above two functions when all your commands can be executed by the first function that is
void addition(int a,int b,int c=3, int d=4);
This can execute all the below calls.
additon(1,2,3,2);
addition(6,7,8);
addition(5,1);
void addition(int,int); Not allowed by the compiler.
Why do you need the above two functions when all your commands can be executed by the first function that is
void addition(int a,int b,int c=3, int d=4);
This can execute all the below calls.
additon(1,2,3,2);
addition(6,7,8);
addition(5,1);
Varsharani buktare said:
1 decade ago
Actually , I have one doubt that suppose prototype of some overloaded functions.
void addition(int a,int b,int c=3, int d=4);
void addition(int,int);
& In our program we write the function call like:
additon(1,2,3,2);
addition(6,7,8);
addition(5,1); // Which function going to call the compiler here?
Or compiler get the ambiguity?
What happens exactly?
void addition(int a,int b,int c=3, int d=4);
void addition(int,int);
& In our program we write the function call like:
additon(1,2,3,2);
addition(6,7,8);
addition(5,1); // Which function going to call the compiler here?
Or compiler get the ambiguity?
What happens exactly?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers