#include<iostream.h>
#include<conio.h>
class joshi
{
public:
int a,b;
void setdata(int x,int y)
{
a=x;
b=y;
}
void show(int z);
};
void joshi::show(int z)
{
cout<<"\n\t"<<z;
}
class toti:public joshi
{
public:
int area()
{
return a*b;
}
};
class sukal:public joshi
{
public:
int area()
{
return a/b;
}
};
void main()
{
clrscr();
toti t1;
sukal s1;
t1.setdata(10,2);
s1.setdata(10,2);
t1.show(t1.area());
s1.show(s1.area());
getch();
}
#include<conio.h>
class joshi
{
public:
int a,b;
void setdata(int x,int y)
{
a=x;
b=y;
}
void show(int z);
};
void joshi::show(int z)
{
cout<<"\n\t"<<z;
}
class toti:public joshi
{
public:
int area()
{
return a*b;
}
};
class sukal:public joshi
{
public:
int area()
{
return a/b;
}
};
void main()
{
clrscr();
toti t1;
sukal s1;
t1.setdata(10,2);
s1.setdata(10,2);
t1.show(t1.area());
s1.show(s1.area());
getch();
}
No comments:
Post a Comment