当前位置: 首页 > news >正文

东莞有哪些做网站百度推广客户端怎样注册

东莞有哪些做网站,百度推广客户端怎样注册,龙岗做网站哪里找,装修设计方案实现一个图形类(Shape),包含受保护成员属性:周长、面积, 公共成员函数:特殊成员函数书写 定义一个圆形类(Circle),继承自图形类,包含私有属性:半…

实现一个图形类(Shape),包含受保护成员属性:周长、面积,

公共成员函数:特殊成员函数书写

定义一个圆形类(Circle),继承自图形类,包含私有属性:半径

公共成员函数:特殊成员函数、以及获取周长、获取面积函数

定义一个矩形类(Rect),继承自图形类,包含私有属性:长度、宽度

公共成员函数:特殊成员函数、以及获取周长、获取面积函数

在主函数中,分别实例化圆形类对象以及矩形类对象,并测试相关的成员函数。

#include <iostream>using namespace std;
class Shape
{
protected:double round;double area;
public:Shape(){cout<<"无参构造"<<endl;}Shape(double r,double a):round(r),area(a){cout<<"有参构造"<<endl;}~Shape(){cout<<"析构函数"<<endl;}Shape(const Shape &other):round(other.round),area(other.area){cout<<"拷贝构造"<<endl;}Shape & operator=(const Shape &other){this->area=other.area;this->round=other.round;cout<<"拷贝赋值"<<endl;return *this;}Shape & operator=(Shape &&other){this->area=other.area;this->round=other.round;cout<<"移动赋值"<<endl;return *this;}};
class Circle:public Shape
{
private:double bj;
public:Circle() {}Circle(double r):bj(r){cout<<"有参构造"<<endl;}~Circle(){cout<<"析构函数"<<endl;}Circle(const Circle &other):Shape(other.round,other.area),bj(other.bj){cout<<"拷贝构造"<<endl;}Circle & operator=(const Circle &other){this->area=other.area;this->round=other.round;this->bj=other.bj;cout<<"拷贝赋值"<<endl;return *this;}Circle & operator=(Circle &&other){this->area=other.area;this->round=other.round;this->bj=other.bj;cout<<"移动赋值"<<endl;return *this;}void zc(){this->round=this->bj*2*(3.14);cout<<"周长="<<round<<endl;}void mj(){this->area=this->bj*this->bj*(3.14);cout<<"面积="<<area<<endl;}void show(){cout<<"周长="<<round<<endl;cout<<"面积="<<area<<endl;}
};
class Rect:public Shape
{
private:double hight;double wight;
public:Rect() {}Rect(double h,double w):hight(h),wight(w){cout<<"有参构造"<<endl;}~Rect(){cout<<"析构函数"<<endl;}Rect(const Rect &other):Shape(other.round,other.area),hight(other.hight),wight(other.wight){cout<<"拷贝构造"<<endl;}Rect & operator=(const Rect &other){this->area=other.area;this->round=other.round;this->hight=other.hight;this->wight=other.wight;cout<<"拷贝赋值"<<endl;return *this;}Rect & operator=(Rect &&other){this->area=other.area;this->round=other.round;this->hight=other.hight;this->wight=other.wight;cout<<"移动赋值"<<endl;return *this;}void zc(){this->round=(this->hight+this->wight)*2;cout<<"周长="<<round<<endl;}void mj(){this->area=this->hight*this->wight;cout<<"面积="<<area<<endl;}void show(){cout<<"周长="<<round<<endl;cout<<"面积="<<area<<endl;}
};
int main()
{Circle c1(10);c1.zc();c1.mj();Circle c2(c1);c2.show();Circle c3;c3=c1;c3.show();Circle c4;c4=move(c3);c3.show();c4.show();cout<<"******************************************"<<endl;Rect r1(10,5);r1.mj();r1.zc();Rect r2=r1;r2.show();Rect r3;r3=r1;r3.show();return 0;
}

http://www.15wanjia.com/news/35455.html

相关文章:

  • 用jsp做的网站能搜任何网站的浏览器
  • 深圳专业网站建设价格济宁百度推广公司有几家
  • 网站可以做库存吗产品网络推广
  • 建设银行官方网站首页优化网络的软件
  • bt网站建设semester是什么意思
  • 青岛工程建设管理信息网站下载百度排名竞价
  • 电商公司做网站b站视频未能成功转码
  • 一个公司可以做几个百度推广seo教程自学入门教材
  • 怎么让百度收录网站广告公司的业务范围
  • 做推广的网站网络推广公司企业
  • 龙华营销型网站建设学seo如何入门
  • shopex 网站搬家网站排名软件利搜
  • 做高大上分析的网站西安网站开发
  • wordpress做电商安全吗seo优化的优点
  • 哈尔滨网站推广公司整合营销网络推广
  • 广州网站制作系统如何进行关键词分析
  • 上海电商设计招聘网站网站及推广
  • 国外服务器商百度搜索引擎优化详解
  • 河南省建筑市场监管信息一体化平台深圳短视频seo教程
  • 网站是做响应式还是自适应的好精准推广
  • 做淘客网站的公司宁波如何做seo排名优化
  • 诚信网站费用如何制作一个网页
  • WordPress前台用户发布南昌seo排名扣费
  • 网站建设免责申明书搜索引擎哪个好用
  • crm客户管理系统官网网站的优化从哪里进行
  • wordpress更改ip地址北京seo网站开发
  • 免费素材网站图库bt磁力bt天堂
  • 免费做网站送域名的免费网站模板网
  • 婚纱网站模板长沙网站优化方法
  • 珠海网站建设方案维护品牌营销推广策划公司