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

write a program that takes input in digits and display the result in words from 1 to 1000

1987


What is the full form of oops?

607


Which language is not a true object oriented programming language?

640


Why we use classes in oop?

581


Why is it so that we can have virtual constructors but we cannot have virtual destructors?

3835






Plese get me a perfect C++ program for railway/airway reservation with all details.

3427


What is super in oop?

599


What is the advantage of oop over procedural language?

627


What is class in oop with example?

621


How long to learn object oriented programming?

563


Can you name some types of inheritance?

640


What is polymorphism in oops?

558


Why can't we have instance(stack) of a class as a member of the same class like eg.Class A{A obj;} as we can have self refential pointer

1618


What is destructor in oop?

623


How oops is better than procedural?

585