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

Answer Posted / shubham hajare

#include "stdafx.h"
#include<iostream>
#include<conio.h>
using namespace std;
class stud
{
public:
void add(int a,int b)
{
cout<<a+b;
}

void add(float a,float b)
{
cout<<a+b;
}

void add(int a,float b)
{
cout<<a+b;
}


};
void main()
{
stud a;
a.add(12,12);
a.add(1.2,1.2);
a.add(12,12.2);
_getch();
}

Is This Answer Correct ?    3 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is polymorphism explain?

677


What are the 4 main oop principles?

670


What is a superclass in oop?

663


Get me an image implementation program.

1554


What is the problem with multiple inheritance?

578






What is meant by oops concept?

603


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

2319


What are the data types in oop?

597


Why is static class not inherited?

590


Why do we use polymorphism?

570


What is coupling in oops?

589


What is interface? When and where is it used?

1657


What is the real time example of inheritance?

631


What are the two different types of polymorphism?

666


What is encapsulation with example?

570