//base class Polygon
//derived classes Rectangle and Triangle
#include <iostream>
using namespace std;
class Polygon
{
protected:
int dim1,dim2;
public:
Polygon()
{
dim1=dim2=0;
}
Polygon(int d1,int d2)
{
dim1=d1;
dim2=d2;
}
};
class Rectangle:public Polygon
{
public:
//derived classes Rectangle and Triangle
#include <iostream>
using namespace std;
class Polygon
{
protected:
int dim1,dim2;
public:
Polygon()
{
dim1=dim2=0;
}
Polygon(int d1,int d2)
{
dim1=d1;
dim2=d2;
}
};
class Rectangle:public Polygon
{
public:
Rectangle(int x,int y):Polygon(x,y)
{
}
int Area()
{
return dim1*dim2;
}
{
}
int Area()
{
return dim1*dim2;
}
No comments:
Post a Comment