summaryrefslogtreecommitdiff
path: root/xsd/examples/cxx/parser/multiroot/protocol.hxx
blob: bbf5b563c8cad7f20e3daee62cb27e3835964041 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// file      : examples/cxx/parser/multiroot/protocol.hxx
// copyright : not copyrighted - public domain

#ifndef PROTOCOL_HXX
#define PROTOCOL_HXX

namespace protocol
{
  class request
  {
  public:
    virtual
    ~request ()
    {
    }

    unsigned int
    account () const
    {
      return account_;
    }

  protected:
    request (unsigned int account)
        : account_ (account)
    {
    }

  private:
    unsigned int account_;
  };

  class balance: public request
  {
  public:
    balance (unsigned int account)
        : request (account)
    {
    }
  };

  class withdraw: public request
  {
  public:
    withdraw (unsigned int account, unsigned int amount)
        : request (account), amount_ (amount)
    {
    }

    unsigned int
    amount () const
    {
      return amount_;
    }

  private:
    unsigned int amount_;
  };
}

#endif // PROTOCOL_HXX