summaryrefslogtreecommitdiff
path: root/graphs/cpp/my_nfts/person.hh
blob: 90a2e1677cb7ac8520bf27b348ba86940bdd2a50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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);