aboutsummaryrefslogtreecommitdiff
path: root/examples/cxx/parser/polymorphism/supermen-pimpl.cxx
blob: 8a30cbd8c231553364a8ff7effe6e19e5cdb8639 (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
77
78
79
80
81
82
83
84
85
86
// file      : examples/cxx/parser/polymorphism/supermen-pimpl.cxx
// author    : Boris Kolpackov <boris@codesynthesis.com>
// copyright : not copyrighted - public domain
//

#include <iostream>

#include "supermen-pimpl.hxx"

using std::cout;
using std::endl;

// person_pimpl
//
void person_pimpl::
pre ()
{
  cout << "starting to parse person" << endl;
}

void person_pimpl::
name (const std::string& v)
{
  cout << "name: " << v << endl;
}

void person_pimpl::
post_person ()
{
  cout << "finished parsing person" << endl
       << endl;
}

// superman_pimpl
//
void superman_pimpl::
pre ()
{
  cout << "starting to parse superman" << endl;
}

void superman_pimpl::
can_fly (bool v)
{
  cout << "can-fly: " << v << endl;
}

void superman_pimpl::
post_person ()
{
  post_superman ();
}

void superman_pimpl::
post_superman ()
{
  cout << "finished parsing superman" << endl
       << endl;
}

// batman_pimpl
//
void batman_pimpl::
pre ()
{
  cout << "starting to parse batman" << endl;
}

void batman_pimpl::
wing_span (unsigned int v)
{
  cout << "wing-span: " << v << endl;
}

void batman_pimpl::
post_superman ()
{
  post_batman ();
}

void batman_pimpl::
post_batman ()
{
  cout << "finished parsing batman" << endl
       << endl;
}