write a program in c++ to overload the function add (s1,s2)
where s1 and s2 are integers and floating point values.

Answer Posted / rose

include<iostream.h>

class overload
{
void add (int a, int b){
int c;
int c= a+b;
}
void add( float a,float b){
double c;
double c = a+b;}
}
void main()
{overload o = new overload();
o.add(10,20);
o.add(1.2,34.56);
getch();
}

Is This Answer Correct ?    14 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does and I oop mean?

610


hi all..i want to know oops concepts clearly can any1 explain??

1675


Why do pointers exist?

651


What is encapsulation with example?

570


i got a backdoor offer in process global,Bangalore..Can i work with it?

2319






What is new keyword in oops?

586


what is the sylabus for priliminaries?

1677


What are oops methods?

561


Can private class be inherited?

613


What are the benefits of polymorphism?

614


what is different between oops and c++

1995


String = "C++ is an object oriented programming language.An imp feature of oops is classes and objects".Write a pgm to count the repeated words from this scenario?

1933


Which method cannot be overridden?

572


write a program that takes input in digits and display the result in words from 1 to 1000

1980


Why is polymorphism important in oop?

627