📄 item.cpp
字号:
#include "Item.h"
Item::Item(string name) {
this->mName = name;
this->mCount = 1;
this->mSeq = 0;
}
Item::Item(string name, int count, int seq) {
this->mName = name;
this->mCount = count;
this->mSeq = seq;
}
string Item::getName() const {
return mName;
}
int Item::getCount() const {
return mCount;
}
int Item::getSeq() const {
return mSeq;
}
void Item::incrementCount() {
mCount++;
}
void Item::setCount(int i) {
mCount = i;
}
bool Item::operator<(const Item& anotherItem) const {
if (this->getCount() == anotherItem.getCount()) {
return (this->getSeq() < anotherItem.getSeq());
} else {
return (this->getCount() < anotherItem.getCount());
}
};
bool Item::operator>(const Item& anotherItem) const {
if (this->getCount() == anotherItem.getCount()) {
return (this->getSeq() > anotherItem.getSeq());
} else {
return (this->getCount() > anotherItem.getCount());
}
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -