home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 57
/
Amiga_Dream_57.iso
/
Prog_objet
/
figure.h
< prev
next >
Wrap
C/C++ Source or Header
|
1998-11-09
|
912b
|
45 lines
class Figure {
public:
Figure(float x=0 , float y=0) : _x(x), _y(y) {}
float getX() const { return _x; }
float getY() const { return _y; }
void translate(float dx, float dy);
virtual float surface() const = 0;
private:
float _x,_y;
};
class Rectangle : public Figure {
public:
Rectangle(float c1, float c2, float x=0, float y=0)
: Figure(x,y), _c1(c1), _c2(c2) {}
float getC1() const { return _c1; }
float getC2() const { return _c2; }
void setC1(float c1) { _c1 = c1; }
void setC2(float c2) { _c2 = c2; }
/* virtual */ float surface() const;
private:
float _c1,_c2;
};
class Cercle : public Figure {
public:
Cercle(float r, float x=0, float y=0)
: Figure(x,y) , _r(r) {}
float getRadius() const { return _r; }
void setRadius(float r) { _r = r; }
/* virtual */ float surface() const;
private:
float _r;
};