#include <iostream>
using namespace std;
class point
{
int x;
int y;
public :
point ()
{
x=y=;
}
point (int a,int b)
{
x=a;
y=b;
}
~point (){}
void show ()
{
cout <<"("<<x<<","<<y<<")"<<endl;
}
};
class Shape
{
private:
double longth;
double width;
public :
Shape ()
{
longth=width=;
}
Shape (double l,double w)
{
longth=l;
width=w;
cout<<"构造函数,创建Shape"<<endl;
}
~Shape()
{
cout <<"析构函数,释放Shape"<<endl;
}
double area()
{
double s;
s=longth*width;
return s;
}
void show ()
{
cout <<"面积="<<area()<<endl;
}
};
class Rectangle:public Shape
{
public :
Rectangle():Shape(,){}
Rectangle(double a,double b):Shape(a,b)
{
cout<<"创建Rectangle"<<endl;
}
void show ()
{
cout <<"面积="<<area()<<endl;
}
~Rectangle()
{
cout <<"析构函数,释放Rectangle"<<endl;
}
};
class Square:public Rectangle
{
public :
Square(double a):Rectangle(a,a)
{
cout<<"构造函数,创建Square"<<endl;
}
~Square()
{
cout <<"析构函数,释放Square"<<endl;
}
};
class Circle:public Shape
{
private :
double r;
point p;
public :
Circle(double c,point n):Shape(c,c)
{
r=c;
p=n;
cout<<"构造函数,创建Circle"<<endl;
}
~Circle()
{
cout <<"析构函数,释放Circle"<<endl;
}
double area()
{
double s;
s=3.14*r*r;
return s;
}
void show ()
{
cout <<"面积="<<area()<<endl;
}
};
int main()
{
Rectangle r(,);
r.show();
point o(,);
Circle c (4.0,o);
c.show ();
Square s();
s.show();
return ;
}

Exercise about Shape的更多相关文章

  1. (14)Why some people find exercise harder than others

    https://www.ted.com/talks/emily_balcetis_why_some_people_find_exercise_harder_than_others/transcript ...

  2. OpenCASCADE Shape Location

    OpenCASCADE Shape Location eryar@163.com Abstract. The TopLoc package of OpenCASCADE gives resources ...

  3. Drawable实战解析:Android XML shape 标签使用详解(apk瘦身,减少内存好帮手)

    Android XML shape 标签使用详解   一个android开发者肯定懂得使用 xml 定义一个 Drawable,比如定义一个 rect 或者 circle 作为一个 View 的背景. ...

  4. Android GradientDrawable(shape标签定义) 静态使用和动态使用(圆角,渐变实现)

    Android GradientDrawable使用优势: 1. 快速实现一些基本图形(线,矩形,圆,椭圆,圆环) 2. 快速实现一些圆角,渐变,阴影等效果 3. 代替图片设置为View的背景 4. ...

  5. AlloyRenderingEngine之Shape

    写在前面 不读文章,只对代码感兴趣可以直接跳转到这里 https://github.com/AlloyTeam/AlloyGameEngine 然后star一下,多谢支持:). 游戏或者应用中,不是所 ...

  6. 浅谈Android样式开发之shape

    引言 在Android开发中我们很多情况都是使用图片来展示相关效果,今天我就来详细介绍下Android下使用Shape来进行简单UI的开发.一方面这些是Android开发的基础,另一方面这方面的知识可 ...

  7. VSTO PowerPoint 代码删除Shape后再恢复出现无法再次获取的问题

    做PowerPoint的VSTO插件项目,遇到个很奇怪的问题,当代码执行删除某些Shape时,没问题,但是操作Undo也就是恢复后,无法再次获取到之前删除的对象,这种情况只在Office2007中出现 ...

  8. android shape的使用(转)

    shape用于设定形状,可以在selector,layout等里面使用,有6个子标签,各属性如下: <?xml version="1.0" encoding="ut ...

  9. 【Android进阶学习】shape和selector的结合使用(转)

    原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://liangruijun.blog.51cto.com/3061169/732310 ...

随机推荐

  1. Windows 使用 Gogs 搭建 Git 服务器(转)

    Windows 使用 Gogs 搭建 Git 服务器   随便说两句 之前有使用 Gitblit 在Windows搭建Git服务器,用的也挺好的,可能安装起来略麻烦一点.现在全用 Gogs 在wind ...

  2. Windows server 2008普通用户不能远程登录问题

    1.查登录权限 如果文件服务器没有为用户授权,那么用户自然就不能远程登录服务器系统了,为此笔者决定先仔细检查一下文件服务器系统是否为自己使用的登录账号,授予了远程登录权限.在进行这种检查时,笔者先是在 ...

  3. RTT(往返时间)和RPC

    RTT(Round-Trip Time)往返时间在计算机网络中它是一个重要的性能指标.表示从发送端发送数据开始,到发送端收到来自接收端的确认(接收端收到数据后便立即发送确认,不包含数据传输时间)总共经 ...

  4. ss搭建

    aliyun ecs ,hongkong , t5 , 1M, 1.卸载阿里云盾监控 wget http://update.aegis.aliyun.com/download/uninstall.sh ...

  5. struts与servlet共存

    <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2 ...

  6. iOS 定时器 NSTimer、CADisplayLink、GCD3种方式的实现

    在软件开发过程中,我们常常需要在某个时间后执行某个方法,或者是按照某个周期一直执行某个方法.在这个时候,我们就需要用到定时器. 然而,在iOS中有很多方法完成以上的任务,到底有多少种方法呢?经过查阅资 ...

  7. iOS - 国内注册境外 Apple id 账号

    注册前准备工作 需要手头MAC一台 AppStore下载VPN Plus FQ到美国(ipip.net 查看当前ip 是否是在境外 当前ip 在境外才可以哦) 动手搞起来 https://applei ...

  8. 从0移植uboot(三) _编译最小可用uboot

    前两篇介绍了uboot-2013.01的配置原理以及大体的运行流程,本文将讨论如何对uboot源码进行配置,将一个可用的uboot烧录到SD卡中. 定制自己的core board 市面上能买到的开发板 ...

  9. Java字符串连接的多种实现方法及效率对比

    JDK 1.8(Java 8)里新增String.join()方法用于字符串连接.本文基于<Java实现String.join()和效率比较>一文,分析和比较四种自定义实现与String. ...

  10. WPS 关闭 wpscenter.exe 服务

    1.Ctrl + Shift + Esc 打开任务管理,结束wps相关的进程 2.新建文本文件,并命名为:wpscenter.exe 3.重命名 C:\Program Files1\WPS Offic ...