write a program for function overloading?

Answer Posted / nekkanti rajesh

#include<iiostream.h>
class overload
{
public:
int max(int,int);
floatmax(float,float);
};
int overload::max(int num1,int num2)
{
if(num1>nmu2)
{
return num1;
}
else
{
return num2;
}
}
float overload::max(float num1,float num2)
{
if(num1>num2)
{
return num1;
}
else
{
return num2;
}
}
int main(90
{
overload o1;
cout<<"o1.max(5.4f,8.6f)<<endl;
cout<<"o1.max(19,34)<<endl;
}

Is This Answer Correct ?    143 Yes 57 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is purpose of inheritance?

659


What is the purpose of polymorphism?

689


What is the diamond problem in inheritance?

600


Why is oop better than procedural?

618


Hi friends I have experience of 6 months in website design and maintanence. Now i am looking for other IT jobs.. to switch platform. please post any interview you know in chennai.

1800






What is static in oop?

601


What is multilevel inheritance explain with example?

644


What is protected in oop?

622


What is destructor example?

615


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

1633


What is the renewal class?

2179


Write a program to sort the number with different sorts in one program ??

1930


What is the problem with multiple inheritance?

600


What is polymorphism in oops with example?

543


What is this pointer in oop?

571