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

📄 rectangle.cpp

📁 设计并测试一个名为Rectangle的矩形类
💻 CPP
字号:
// Rectangle.cpp: implementation of the CRectangle class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Rectangle.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CRectangle::CRectangle(int top,int left,int bottom,int right)
{
	itsTop=top;
	itsLeft=left;
	itsBottom=bottom;
	itsRight=right;

}

CRectangle::~CRectangle()
{

}

int CRectangle::GetTop() const
{
	return itsTop;

}

int CRectangle::GetLeft() const
{
	return itsLeft;

}

int CRectangle::GetBottom() const
{
	return itsBottom;

}

int CRectangle::GetRight() const
{
	return itsRight;

}

void CRectangle::SetTop(int top)
{
	itsTop=top;

}

void CRectangle::SetLeft(int left)
{
	itsLeft=left;

}

void CRectangle::SetBottom(int bottom)
{
	itsBottom=bottom;

}

void CRectangle::SetRight(int right)
{
	itsRight=right;

}

int CRectangle::GetArea() const
{
	int Width=itsRight-itsLeft;
	int Height=itsTop-itsBottom;
	return(Width * Height);

}

⌨️ 快捷键说明

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