aboutsummaryrefslogtreecommitdiff
path: root/examples/cxx/parser/polyroot/supermen-pimpl-tiein.hxx
blob: ea2a6a419c287b1cee235fa4cfe3a0e203a34c4d (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// file      : examples/cxx/parser/polyroot/supermen-pimpl-tiein.hxx
// copyright : not copyrighted - public domain

#ifndef SUPERMEN_PIMPL_HXX
#define SUPERMEN_PIMPL_HXX

#include "supermen-pskel.hxx"

class person_pimpl: public person_pskel
{
public:
  virtual void
  pre ();

  virtual void
  name (const std::string&);

  virtual void
  post_person ();
};

class superman_pimpl: public superman_pskel
{
public:
  superman_pimpl ();

  virtual void
  pre ();

  virtual void
  can_fly (bool);

  // By default, post_superman() calls post_person(). In case of
  // polymorphic parsing we want the opposite: post_person() calls
  // post_superman().
  //
  virtual void
  post_person ();

  virtual void
  post_superman ();

private:
  person_pimpl base_impl_;
};

class batman_pimpl: public batman_pskel
{
public:
  batman_pimpl ();

  virtual void
  pre ();

  virtual void
  wing_span (unsigned int);

  // By default, post_batman() calls post_superman() which calls
  // post_person(). In case of polymorphic parsing we want the
  // opposite: post_person() calls post_superman() which calls
  // post_batman().
  //
  virtual void
  post_person ();

  virtual void
  post_superman ();

  virtual void
  post_batman ();

private:
  superman_pimpl base_impl_;
};

#endif // SUPERMEN_PIMPL_HXX