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

📄 circle.hpp

📁 这个学期我学习是神经网络课程,有很多的知识国内都不是很完善,而国外就有很大的进步,下面就是来自一本 <AI for Game>的电子版英文书.其中我就拿用面向对象写的C++类进行说明怎样
💻 HPP
字号:
#define PI 3.14 namesapce Smart { class point { public: point(int _x,int _y) :x(_x),y(_y) {} int getX() const{ return x; } int getY() const{ return y; } void setX(const int _x){ x=_x; } void setY(const int _y){ y=_y; } point& operator=(const point &rhs){             x=rhs.getX();             y=rhs.getY();             return *this;         } private: int x; int y; }; class circle:public point { public: circle(point &_pp,double _radius)         :pp(_pp),radius(_radius)     {} point getpoint() const{ return pp;} //设置圆的位置 void setpoint(const point &_pp){ pp=_pp; } double getradius() const{ return radius; } //改变圆的大小 void setradius(const double _radius){ radius=_radius; } const double area() { return 2*PI*radius*radius; } private: point pp; double radius; }; } 

⌨️ 快捷键说明

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