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
What is purpose of inheritance?
What is the purpose of polymorphism?
What is the diamond problem in inheritance?
Why is oop better than procedural?
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.
What is static in oop?
What is multilevel inheritance explain with example?
What is protected in oop?
What is destructor example?
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
What is the renewal class?
Write a program to sort the number with different sorts in one program ??
What is the problem with multiple inheritance?
What is polymorphism in oops with example?
What is this pointer in oop?