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
What is polymorphism explain?
What are the 4 main oop principles?
What is a superclass in oop?
Get me an image implementation program.
What is the problem with multiple inheritance?
What is meant by oops concept?
i got a backdoor offer in process global,Bangalore..Can i work with it?
What are the data types in oop?
Why is static class not inherited?
Why do we use polymorphism?
What is coupling in oops?
What is interface? When and where is it used?
What is the real time example of inheritance?
What are the two different types of polymorphism?
What is encapsulation with example?