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


Please Help Members By Posting Answers For Below Questions

What is ambiguity in inheritance?

636


Explain the advantages of inheritance.

684


What is cohesion in oop?

634


What is encapsulation selenium?

566


What is super in oop?

609






What do you mean by overloading?

597


What is interface? When and where is it used?

1671


What is abstract class in oops?

608


What is the real life example of polymorphism?

620


What is destructor in oop?

634


How can you overcome the diamond problem in inheritance?

781


hi all..i want to know oops concepts clearly can any1 explain??

1689


Is abstract thinking intelligence?

607


What do you mean by variable?

587


What is polymorphism programming?

613