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

Answer Posted / deepa mathur

include <iostream.h>

void add (int s1, int s2)
{
int s3;
s3= s1 + s2;
cout<<"sum of 2 no. is= "<< s3;
}

void add (float s1, float s2)
{
float s3;
s3 = s1 + s2;
cout<<" sum of 2 no. is= "<< s3;
}

void main
{
void add (int a, int b);
void add (float a, float b);
add(30, 20);
add (30.5, 56.7);
getch();
}

Is This Answer Correct ?    47 Yes 20 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the main purpose of inheritance law?

766


What is interface in oop?

757


what is different between oops and c++

2081


Can we create object of abstract class?

661


Why is oop useful?

699






How do you use inheritance in unity?

680


why reinterpret cast is considered dangerous?

1995


write a program using c++ to implement single contiguous memory mangement techniques.display the content of the main memory after yhe allocation of jobs and percentage of the wastage of the main memory

2853


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

1751


What is encapsulation in oops?

633


What is object and example?

702


write string class as your own class in java without using any built-in function

2063


What is overriding vs overloading?

670


What is the full form of oops?

784


What is difference between abstraction and encapsulation?

691