aboutsummaryrefslogtreecommitdiff
path: root/inheritance/polymorphism/employee.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-04-25 10:45:32 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-04-25 10:45:32 +0200
commitab994fdada3eebc794d6b1686f55a35420e4d758 (patch)
treeccfbdd212fc3a06fea8f68b07c01f68989d2e450 /inheritance/polymorphism/employee.cxx
parent27245519b1a659eb849a31714df0090dc58bb87a (diff)
New example, inheritance/polymorphism
Also move the inheritance example to inheritance/reuse.
Diffstat (limited to 'inheritance/polymorphism/employee.cxx')
-rw-r--r--inheritance/polymorphism/employee.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/inheritance/polymorphism/employee.cxx b/inheritance/polymorphism/employee.cxx
new file mode 100644
index 0000000..83a51e6
--- /dev/null
+++ b/inheritance/polymorphism/employee.cxx
@@ -0,0 +1,27 @@
+// file : inheritance/polymorphism/employee.cxx
+// copyright : not copyrighted - public domain
+
+#include <iostream>
+
+#include "employee.hxx"
+
+using namespace std;
+
+person::
+~person ()
+{
+}
+
+void employee::
+print ()
+{
+ cout << first_ << ' ' << last_
+ << (temporary_ ? " temporary " : " permanent ")
+ << "employee" << endl;
+}
+
+void contractor::
+print ()
+{
+ cout << first_ << ' ' << last_ << ' ' << email_ << " contractor" << endl;
+}