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

📄 d_circsh.h

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

#include "d_shape.h"

// declaration of circleShape class with base class shape
class circleShape: public shape
{
   public:
      circleShape(double x = 0.0, double y = 0.0,
                  double r = 0.0, shapeColor c = darkgray);
	      // arguments for the base point, radius and color

      double getRadius() const;
      void setRadius(double r);
	      // retrieve or set the radius

      virtual void draw();
	      // draw the circle

   private:
      double radius;
			// radius of the circle
};

circleShape::circleShape(double x, double y, double r,
                     shapeColor c): shape(x,y,c), radius(r)
{}

// read the radius value; return value of private radius data
double circleShape::getRadius() const
{
   return radius;
}

// change the radius value of the current object
void circleShape::setRadius(double r)
{
   radius = r;          // assign r as the new radius
}

// draw the circleShape with center at (x,y), given radius
// and color
void circleShape::draw()
{
   EZDCOLORVAL old_color;
   
   old_color = ezdSetColor(color.convertToEzdColor());
   shape_handle = ezdDrawCircle(baseX, baseY, radius);
   ezdSetColor(old_color);
}

#endif   // CIRCLESHAPE_CLASS

⌨️ 快捷键说明

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