more on articles

This commit is contained in:
Martin Brodbeck 2018-07-11 12:52:57 +02:00
parent 4d8396fac1
commit 8b08fad47a
2 changed files with 18 additions and 22 deletions

View file

@ -1,24 +1,15 @@
#include "article.h"
Article::Article() : Entity()
{}
Article::Article() : Entity() {}
Article::Article(const std::shared_ptr<Seller> sellerPtr) : Entity()
{
this->sellerPtr = sellerPtr;
}
Article::Article(std::shared_ptr<Seller> sellerPtr) : Entity() { sellerPtr_ = sellerPtr; }
void Article::setArticleNo(int articleNo)
{
this->articleNo = articleNo;
}
void Article::setArticleNo(int articleNo) { articleNo_ = articleNo; }
void Article::setPrice(int price)
{
this->price = price;
}
void Article::setPrice(int price) { price_ = price; }
void Article::setDescription(const std::string& description)
{
this->description = description;
}
void Article::setDescription(const std::string& description) { description_ = description; }
void Article::setSale(const std::shared_ptr<Sale> salePtr) { salePtr_ = salePtr; }
bool Article::isSold() { return salePtr_ ? true : false; }

View file

@ -3,6 +3,7 @@
#include "entity.h"
#include "seller.h"
#include "sale.h"
#include <string>
#include <memory>
@ -17,11 +18,15 @@ public:
void setArticleNo(int articleNo);
void setPrice(int price);
void setDescription(const std::string& description);
bool isSold();
void setSale(const std::shared_ptr<Sale> salePtr);
void setSeller(std::shared_ptr<Seller> sellerPtr);
private:
std::shared_ptr<Seller> sellerPtr{};
int articleNo{};
int price{};
std::string description{};
std::shared_ptr<Seller> sellerPtr_{};
std::shared_ptr<Sale> salePtr_{};
int articleNo_{};
int price_{};
std::string description_{};
};
#endif