aboutsummaryrefslogtreecommitdiff
path: root/pimpl/person.cxx
blob: 6922afc872c0b231c800f5e1c3a65127d8a9eccf (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
// file      : pimpl/person.cxx
// copyright : not copyrighted - public domain

#include "person.hxx"

using namespace std;

struct person::impl
{
  impl () {}
  impl (const string& e, const string& n, unsigned short a)
      : email (e), name (n), age (a) {}

  string email;
  string name;
  unsigned short age;
};

person::
~person ()
{
  delete pimpl_;
}

person::
person ()
    : pimpl_ (new impl)
{
}

person::
person (const string& e, const string& n, unsigned short a)
    : pimpl_ (new impl (e, n, a))
{
}

const string& person::
email () const
{
  return pimpl_->email;
}

void person::
email (const string& e)
{
  pimpl_->email = e;
}

const string& person::
name () const
{
  return pimpl_->name;
}

void person::
name (const string& n)
{
  pimpl_->name = n;
}

unsigned short person::
age () const
{
  return pimpl_->age;
}

void person::
age (unsigned short a) const
{
  pimpl_->age = a;
}