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