⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 d_rectsh.h

📁 这是数据结构和算法的国外经典书籍.清华大学出版社出版的<数据结构C++语言描述-应用模板库STL>陈君 译 英文名称是Data Structures with C++ Using STL.
💻 H
字号:
#ifndef RECTANGLESHAPE_CLASS
#define RECTANGLESHAPE_CLASS

#include "d_shape.h"

// declaration of rectShape class with base class shape
class rectShape: public shape
{
   public:
      rectShape(double x = 0.0, double y = 0.0,
                double len = 0.0, double wid = 0.0,
                shapeColor c = darkgray);
			// constructor. has parameters for the base point,
			// length, width and color

      double getLength() const;
      double getWidth() const;
      void setSides(double len, double wid);
	      // retrieve or set rectangle dimensions

      virtual void draw();
	      // draw the rectangle

   private:
      double length, width;
			// rectangle dimensions

};

rectShape::rectShape(double x, double y, double len, double wid,
                     shapeColor c):
            shape(x,y,c), length(len), width(wid)
{}

double rectShape::getLength() const
{
   return length;
}

double rectShape::getWidth() const
{
   return width;
}

void rectShape::setSides(double len, double wid)
{
   length = len;
   width = wid;
}

void rectShape::draw()
{
   EZDCOLORVAL old_color;
   
   old_color = ezdSetColor(color.convertToEzdColor());

   // execute primitive function and draw the rectangle
   shape_handle = ezdDrawRectangle(baseX, baseY,
                                   baseX+length,baseY+width);

   ezdSetColor(old_color);
}

#endif   // RECTANGLESHAPE_CLASS

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -