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

📄 d_prod.h

📁 数据结构c++语言描述stl版 威廉兄弟的好书,值得看,这是配书代码
💻 H
字号:
#ifndef PRODUCT_CLASS
#define PRODUCT_CLASS

#include <string>

using namespace std;

class product
{
	public:
		product(const string& cmpny = "", const string& nm = "" ):
					company(cmpny), name(nm)
		{}

		// access the value of the product company
		string getCompany() const
		{ return company; }

		// access the value of the product name
		string getName() const
		{ return name; }

		// determine order of objects based on value of company
		friend bool operator< (const product& lhs, const product& rhs)
		{ return lhs.company < rhs.company; }

		// check for objects with the same company
		friend bool operator== (const product& lhs, const product& rhs)
		{ return lhs.company == rhs.company; }

	 private:
		string company;
		string name;
};

#endif	// PRODUCT_CLASS

⌨️ 快捷键说明

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