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
write a program that takes input in digits and display the result in words from 1 to 1000
What is the full form of oops?
Which language is not a true object oriented programming language?
Why we use classes in oop?
Why is it so that we can have virtual constructors but we cannot have virtual destructors?
Plese get me a perfect C++ program for railway/airway reservation with all details.
What is super in oop?
What is the advantage of oop over procedural language?
What is class in oop with example?
How long to learn object oriented programming?
Can you name some types of inheritance?
What is polymorphism in oops?
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
What is destructor in oop?
How oops is better than procedural?