diff options
| author | Fuwn <[email protected]> | 2024-05-31 00:00:12 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-05-31 00:20:41 -0700 |
| commit | 968e1c4af014b7f40bfaa4f57fcc0f38e5e0d847 (patch) | |
| tree | df80525ad0cc9e4b561bfb0772c30ccc5b64b4a2 /include/book_store/customer.hh | |
| parent | feat: initial commit (diff) | |
| download | cst_136_assignment_eight-968e1c4af014b7f40bfaa4f57fcc0f38e5e0d847.tar.xz cst_136_assignment_eight-968e1c4af014b7f40bfaa4f57fcc0f38e5e0d847.zip | |
Diffstat (limited to 'include/book_store/customer.hh')
| -rw-r--r-- | include/book_store/customer.hh | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/include/book_store/customer.hh b/include/book_store/customer.hh new file mode 100644 index 0000000..86f3df6 --- /dev/null +++ b/include/book_store/customer.hh @@ -0,0 +1,49 @@ +#ifndef MEMBER_HH +#define MEMBER_HH + +#include <cstddef> + +#include "book.hh" +#include "person.hh" +#include "price.hh" + +namespace book_store::consumer { +class customer : public person { + +private: + product::book::book::size_type _books_bought; + product::price::usd _amount_spent; + bool _is_member; + +public: + customer(std::string first_name, std::string last_name, std::size_t member_id) + : person(std::move(first_name), std::move(last_name), member_id), + _books_bought(0), _amount_spent(0) {} + customer(std::string first_name, std::string last_name, std::size_t member_id, + bool is_member) + : person(std::move(first_name), std::move(last_name), member_id), + _is_member(is_member) {} + customer(std::string first_name, std::string last_name, std::size_t member_id, + bool is_member, product::book::size_type books_bought, + product::price::usd amount_spent) + : person(std::move(first_name), std::move(last_name), member_id), + _books_bought(books_bought), _amount_spent(amount_spent), + _is_member(is_member) {} + customer() = default; + customer(const customer &) = default; + customer(customer &&) = default; + + [[nodiscard]] auto books_bought() const noexcept -> product::book::size_type; + [[nodiscard]] auto amount_spent() const noexcept -> product::price::usd; + [[nodiscard]] auto is_member() const noexcept -> bool; + + auto books_bought(product::book::size_type books_bought) noexcept -> void; + auto amount_spent(product::price::usd amount_spent) noexcept -> void; + auto is_member(bool is_member) noexcept -> void; + + auto operator=(const customer &) -> customer & = default; + auto operator=(customer &&) -> customer & = default; +}; +} // namespace book_store::consumer + +#endif // MEMBER_HH |