Home >> Sem 2 >> C++ programs >> FUNOVER
/* Write a Program to overload the function */
#include<iostream.h>
#include<conio.h>
class test
{
int r,l,b,h,s,ans;
public:
float draw(int r,float p=3.14);
int draw(int l1,int b1, int h1);
// int draw(int n);
void show(int a)
{
cout<<"ANS : "<<a<<endl;
}
void show(float a)
{
cout<<"ANS : "<<a<<endl;
}
};
float test::draw(int r,float p)
{
ans = p * (r * r);
return ans;
}
int test::draw(int l1,int b1, int h1)
{
return (l1 * b1 * h1);
}
// int test::draw(int n)
// {
// return (n*n);
// }
void main()
{
int a;
float ans;
clrscr();
test t1;
ans = t1.draw(10);
t1.show(ans);
a = t1.draw(10,10,10);
t1.show(a);
getch();
}