diff --git a/src/core/sale.cpp b/src/core/sale.cpp index 8407232..43ecabb 100644 --- a/src/core/sale.cpp +++ b/src/core/sale.cpp @@ -2,9 +2,14 @@ #include +void Sale::addArticle(std::shared_ptr
articlePtr) +{ + articles_.push_back(articlePtr); +} + int Sale::sumInCents() { - int test = std::accumulate(articles_.begin(), articles_.end(), 0, - [](int a, Article* b) { return a + b->getPrice(); }); - return test; + int sum = std::accumulate(articles_.begin(), articles_.end(), 0, + [](int a, std::shared_ptr
b) { return a + b->getPrice(); }); + return sum; } \ No newline at end of file diff --git a/src/core/sale.h b/src/core/sale.h index e4d016e..11253bd 100644 --- a/src/core/sale.h +++ b/src/core/sale.h @@ -13,9 +13,10 @@ class Sale : public Entity { public: int sumInCents(); + void addArticle(std::shared_ptr
articlePtr); private: boost::posix_time::ptime systemTime_{boost::posix_time::second_clock::local_time()}; - std::vector articles_{}; + std::vector> articles_{}; }; #endif \ No newline at end of file