rectangle.h

来自「计算并输出下述各种算法在不同内存容量下的命中率大整数大整数大整数」· C头文件 代码 · 共 37 行

H
37
字号
#include <iostream>
using namespace std;

class Rectangle : public Shape
{
public:
	Rectangle(double _width, double _height);
	double area();
	double girth();
	void show();
private:
	Rectangle();
	double width;
	double height;
};

Rectangle::Rectangle(double _width, double _height)
{
	width = _width;
	height = _height;
}

double Rectangle::area()
{
	return width * height;
}

double Rectangle::girth()
{
	return (width + height) * 2;
}

void Rectangle::show()
{
	Shape::show();
	cout<<"Type: Rectangle"<<endl;
}

⌨️ 快捷键说明

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