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 string class as your own class in java without using any built-in function

1974


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

1678


What is polymorphism give a real life example?

557


explain sub-type and sub class? atleast u have differ it into 4 points?

1830


What is polymorphism and types?

594






What is inheritance in simple words?

622


What is oops in programming?

560


What is Difeerence between List obj=new ArrayList(); and ArrayList obj=new ArrayList()?

2098


Question: Write a program that prints a paycheck. Ask the program user for the name of the employee, the hourly rate, and the number of hours worked. If the number of hours exceeds 40, the employee is paid “time and a half”, that is, 150 percent of the hourly rate on the hours exceeding 40. Be sure to use stepwi se refine ment and break your solution into several functions. Use the int_name function to print the dollar amount of the check.

689


What does <> mean pseudocode?

618


What is the highest level of cohesion?

568


What is multilevel inheritance?

719


What is inheritance in oop?

597


What is balance factor?

578


Can we define a class within the interface?

551