|
|
 |
|
|
|
|
25: int itsRadius;
26: int itsCircumference;
27: };
28:
29: void Circle::Draw()
30: {
31: cout << Circle drawing routine here!\n;
32: }
33:
34:
35: class Rectangle : public Shape
36: {
37: public:
38: Rectangle(int len, int width):
39: itsLength(len), itsWidth(width){}
40: virtual ~Rectangle(){}
41: virtual long GetArea() { return itsLength * itsWidth; }
42: virtual long GetPerim() {return 2*itsLength + 2*itsWidth; }
43: virtual int GetLength() { return itsLength; }
44: virtual int GetWidth() { return itsWidth; }
45: virtual void Draw();
46: private:
47: int itsWidth;
48: int itsLength;
49: };
50:
51: void Rectangle::Draw()
52: {
53: for (int i = 0; i<itsLength; i++)
54: {
55: for (int j = 0; j<itsWidth; j++)
56: cout << x ;
57:
58: cout << \n;
59: }
60: }
61:
62: class Square : public Rectangle
63: {
64: public:
65: Square(int len);
66: Square(int len, int width);
67: ~Square(){}
68: long GetPerim() {return 4 * GetLength();}
69: };
70:
71: Square::Square(int len):
72: Rectangle(len,len)
73: {} |
|
|
|
 |
|
|
|
|
continues |
|
|
|
|
|