goods.cpp

来自「此文件可以能帮你求体积」· C++ 代码 · 共 40 行

CPP
40
字号
// Goods.cpp: implementation of the Goods class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Goods.h"

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

int Goods::totalWeight = 0;

Goods::Goods( int w )
{
	weight = w;
	totalWeight += w;
}

Goods::Goods( Goods& gd )
{
	weight = gd.weight;
	totalWeight += weight;
}

Goods::~Goods()
{
	totalWeight -= weight;
}

int Goods::Get()
{
	return weight;
}

int Goods::GetTotal()
{
	return totalWeight;
}

⌨️ 快捷键说明

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