Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is oops with example?

1050


Why multiple inheritance is not allowed?

1159


Can we create object of abstract class?

1099


What are different types of JVM's? for example we use dalvik jvm for android then what about the remaining operating systems?

2138


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?

3530


Why is abstraction used?

1093


Why is destructor used?

1024


2. Give the different notations for the class.\

2166


What is pointer in oop?

1057


write a programe to calculate the simple intrest and compund intrest using by function overlading

2206


Write a c++ program to display pass and fail for three student using static member function

3401


What type of loop is a for loop?

1091


program for insertion ,deletion,sorting in double link list

2693


What are different oops concepts?

1061


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).

2118