write a program for function overloading?
Answer Posted / krithika
#include<iostream.h>
#include<conio.h>
class a
{
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 ? | 29 Yes | 34 No |
Post New Answer View All Answers
What is multilevel inheritance explain with example?
Can you inherit a private class?
What is Difeerence between List obj=new ArrayList(); and ArrayList obj=new ArrayList()?
What is byval and byref? What are differences between them?
What is inheritance in simple words?
Is enum a class?
What is encapsulation in oops?
Why is polymorphism important in oop?
what type of questions
What is abstraction in oops?
What is polymorphism used for?
What is the real life example of polymorphism?
which feature are not hold visual basic of oop?
What is polymorphism programming?
Why do we use class?