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
Is enum a class?
What is purpose of inheritance?
What is meant by oops concept?
Can a destructor be called directly?
what type of question are asked in thoughtworks pair programming round ?
What is overloading and its types?
What is the main feature of oop?
What is polymorphism in oop example?
Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)
What is abstraction in oops?
What is encapsulation selenium?
What is inheritance and how many types of inheritance?
What is static modifier?
What is overloading in oops?
What does and I oop mean in text?