write a program for function overloading?

Answer Posted / raja

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

Is This Answer Correct ?    28 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

hi, this is raju,iam studying b.tech 2nd year,iam want know about group1 and group2 details, and we can studying without going to any instutions? please help me.

1549


Can we create object of abstract class?

583


What is object in oop with example?

715


What is an advantage of polymorphism?

603


What is encapsulation and abstraction? How are they implemented in C++?

647






Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)

1647


What does sksksk mean in text slang?

1547


What is difference between class and object with example?

571


What is cohesion in oop?

626


What is polymorphism and example?

598


What is difference between inheritance and polymorphism?

579


Prepare me a program for the animation of train

2012


Why is static class not inherited?

602


What is the difference between static polymorphism and dynamic polymorphism?

587


What is inheritance write a program to show use of inheritance?

621