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
What are benefits of oop?
Can enum be null?
What is polymorphism explain its types?
Can bst contain duplicates?
What is encapsulation in oops?
What is balance factor?
Write a program to sort the number with different sorts in one program ??
What do you mean by overloading?
State what is encapsulation and friend function?
program for insertion ,deletion,sorting in double link list
Where You Can Use Interface in your Project
class CTest { public: void someMethod() { int nCount = 0; cout << "This is some method --> " << nCount; } }; int main() { CTest *pctest; pctest->someMethod(); return 0; } It will executes the someMethod() and displays the value too. how is it possible with our creating memory for the class . i think iam not creating object for the class. Thanks in Advance... Prakash
write a programe to calculate the simple intrest and compund intrest using by function overlading
What is the difference between a constructor and a destructor?
Can main method override?