write a program for function overloading?
Answer Posted / krithika
#include<iostream.h>
#include<conio.h>
class a
{
public:
int area(int a)
{
cout<<"enter the side";
cin>>a;
return(a*a);
}
float area(float l,float b)
{
cout<<"enter the length and breadth":
cin>>l>>b;
return(l*b);
}
};
int main()
{
clrscr();
a e;
int a;
float l,b;
cout<<"the area of a square"<<e.area(a);
cout<<"the area of a rectangle"<<e.area(l,b);
getch();
return 0;
}
| Is This Answer Correct ? | 44 Yes | 13 No |
Post New Answer View All Answers
Why do while loop is used?
What is polymorphism oop?
What is use of overloading?
Templates mean
What are the features of oop?
What is oops concept with example?
What does oop mean in snapchat?
What is destructor in oop?
Write A Program to find the ambiguities in Multiple Inheritance? How are they resolved.(Virtual Functions)
What is encapsulation in oops?
What is the purpose of enum?
What is polymorphism give a real life example?
Why do we use polymorphism in oops?
What is abstract class in oops?
Why do we use class?