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
i got a backdoor offer in process global,Bangalore..Can i work with it?
What is polymorphism used for?
What does I oop mean?
Can enum be null?
Write a c++ program to display pass and fail for three student using static member function
What is the purpose of polymorphism?
Question: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date.
What is the benefit of oop?
What does and I oop mean in text?
What is oops and why we use oops?
What is the oops and benefits of oops programming?
What is the highest level of cohesion?
State what is encapsulation and friend function?
What is the types of inheritance?
which feature are not hold visual basic of oop?