diff options
Diffstat (limited to 'graphs/cpp/my_nfts/person.hh')
| -rw-r--r-- | graphs/cpp/my_nfts/person.hh | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/graphs/cpp/my_nfts/person.hh b/graphs/cpp/my_nfts/person.hh new file mode 100644 index 0000000..90a2e16 --- /dev/null +++ b/graphs/cpp/my_nfts/person.hh @@ -0,0 +1,39 @@ +#pragma once + +#include <ostream> +#include <vector> + +#include "nft.hh" + +// A person +class Person +{ +public: + // Initiliaze its member attributes. + Person(const std::string& name, uint money); + + // Returns the list of NFTs it owns. + std::vector<std::string> enumerate_nfts() const; + + // Give it a NFT. + void add_nft(NFT nft); + // Take away a NFT. + NFT remove_nft(const std::string& name); + + // Add money. + void add_money(uint money); + // Remove money, if possible. + bool remove_money(uint money); + + // Getters for money and name. + uint get_money() const; + const std::string& get_name() const; + +private: + std::string name_; + uint money_; + std::vector<NFT> nfts_; +}; + +// Write informations about the person on the given stream. +std::ostream& operator<<(std::ostream& os, const Person& p); |
