WHY FUCTION OVERLOADING DOSENOT RETURN A RETEN TYPE
Answer Posted / manjunathtek
Function overloading has a return type...
Ex:
#include<iostream>
using namespace std;
//Function 1:
int max(int a, int b)
{
return (a>b)? a:b;
}
//Function 2:
float max(float a, float b)
{
return(a>b)? a:b;
}
int main()
{
int c;
float d;
c=max(5,4); //will display 5
cout<<c<<endl;
d=max(3.14,6.15); //will display 6.15
cout<<d<<endl;
return 0;
}
Important Concepts in Fn. Overloading:
a) Fun Overloading depends upon the type/number/order in
which the arguments are passed...
b) Fun Overloading can take place for a function which is
within the same scope... (i.e.) both function 1:, and
Function 2: should be in the same { ...} (both the
functions are within main() (i.e. same scope)...
| Is This Answer Correct ? | 5 Yes | 4 No |
Post New Answer View All Answers
What is oops with example?
Why multiple inheritance is not allowed?
Can we create object of abstract class?
What are different types of JVM's? for example we use dalvik jvm for android then what about the remaining operating systems?
if i have same function with same number of argument but defined in different files. Now i am adding these two files in a third file and calling this function . which will get called and wht decide the precedence?
Why is abstraction used?
Why is destructor used?
2. Give the different notations for the class.\
What is pointer in oop?
write a programe to calculate the simple intrest and compund intrest using by function overlading
Write a c++ program to display pass and fail for three student using static member function
What type of loop is a for loop?
program for insertion ,deletion,sorting in double link list
What are different oops concepts?
assume the program must insert 4 elements from the key board and then do the following programs.sequential search(search one of the elements),using insertion sort(sort the element) and using selection sort(sort the element).