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 are main features of oop?

1181


What do you mean by abstraction?

1123


What are the 3 pillars of oop?

1245


What are the types of abstraction?

1154


What are functions in oop?

1121


What is super in oop?

1261


What is encapsulation in simple terms?

1099


write a code for this:trailer recordId contains a value other than 99, then the file must error with the reason ‘Invalid RECORD_ID’(User Defined Exception).

2206


They started with the brief introduction followed by few basic C++ questions on polumorphism, inheritance and then virtual functions. What is polymorphims? How you will access polymorphic functions in C? How virtual function mechanism works?

1976


What are the 4 pillars of oop?

1206


What is an interface in oop?

1092


Why can't we have instance(stack) of a class as a member of the same class like eg.Class A{A obj;} as we can have self refential pointer

2204


Advantage and disadvantage of routing in telecom sector

1352


What is abstraction in oop with example?

1193


What is the main purpose of inheritance law?

1251