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
What is ambiguity in inheritance?
Explain the advantages of inheritance.
What is cohesion in oop?
What is encapsulation selenium?
What is super in oop?
What do you mean by overloading?
What is interface? When and where is it used?
What is abstract class in oops?
What is the real life example of polymorphism?
What is destructor in oop?
How can you overcome the diamond problem in inheritance?
hi all..i want to know oops concepts clearly can any1 explain??
Is abstract thinking intelligence?
What do you mean by variable?
What is polymorphism programming?