#include<iostream>
using namespace std;
class Shape
{
public:void getArea(){cout<<"this is Shape class"<<endl;}
};
class Rectangle:public Shape
{
private:double x,y;
public:
void putbox(const int newx,const int newy){x=newx;y=newy; cout<<"x,y="<<x<<","<<y<<endl;}
double getArea(){cout<<"x*y="<<x*y<<endl; return x*y;}
};
class Circle:public Shape
{
private:double r;
public:
void putbox(const int newr){r=newr;}
double getArea(){return 3.14*r*r;}
};
class Square:protected Rectangle
{
public:
void putbox(const int newx){Rectangle::putbox(newx,newx);}
double getArea(){double area=Rectangle::getArea();return area;}
};

int main()
{
Square test1;
test1.putbox(2.0);
double t=test1.getArea();
cout<<t<<endl;
}

优质内容筛选与推荐>>
1、Tab选项卡
2、object标签和embed标签
3、ASP.NET 2.0中合并 GridView 的表头单元格(转)
4、css实现三栏布局,两边定宽,中间自适应
5、Requests 代理池


长按二维码向我转账

受苹果公司新规定影响,微信 iOS 版的赞赏功能被关闭,可通过二维码转账支持公众号。

    阅读
    好看
    已推荐到看一看
    你的朋友可以在“发现”-“看一看”看到你认为好看的文章。
    已取消,“好看”想法已同步删除
    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号