69 lines
1.1 KiB
C++
69 lines
1.1 KiB
C++
#include "item.h"
|
|
|
|
Item::Item()
|
|
{
|
|
this->_name = "";
|
|
this->_category = "";
|
|
this->_price = 0;
|
|
}
|
|
|
|
Item::Item(std::string name, std::string category, int price)
|
|
{
|
|
this->_name = name;
|
|
this->_category = category;
|
|
this->_price = price;
|
|
}
|
|
|
|
Item::Item(std::string name, std::string category, int price, std::vector<std::tuple<int,std::string,int>> offers){
|
|
this->_name = name;
|
|
this->_category = category;
|
|
this->_price = price;
|
|
this->_offers = offers;
|
|
}
|
|
|
|
|
|
std::string Item::name()
|
|
{
|
|
return this->_name;
|
|
}
|
|
|
|
std::string Item::category()
|
|
{
|
|
return this->_category;
|
|
}
|
|
|
|
int Item::price() const
|
|
{
|
|
return this->_price;
|
|
}
|
|
|
|
std::vector<std::tuple<int,std::string,int>> Item::offers()
|
|
{
|
|
return this->_offers;
|
|
}
|
|
|
|
void Item::name(std::string name)
|
|
{
|
|
this->_name = name;
|
|
}
|
|
|
|
void Item::category(std::string category)
|
|
{
|
|
this->_category = category;
|
|
}
|
|
|
|
void Item::price(int price)
|
|
{
|
|
this->_price = price;
|
|
}
|
|
|
|
void Item::offers(std::vector<std::tuple<int,std::string,int>> offers)
|
|
{
|
|
this->_offers = offers;
|
|
}
|
|
|
|
void Item::add_offer(std::tuple<int,std::string,int> offer)
|
|
{
|
|
this->_offers.push_back(offer);
|
|
}
|