aboutsummaryrefslogtreecommitdiff
path: root/pimpl/person.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'pimpl/person.cxx')
-rw-r--r--pimpl/person.cxx71
1 files changed, 71 insertions, 0 deletions
diff --git a/pimpl/person.cxx b/pimpl/person.cxx
new file mode 100644
index 0000000..6922afc
--- /dev/null
+++ b/pimpl/person.cxx
@@ -0,0 +1,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;
+}