From ab994fdada3eebc794d6b1686f55a35420e4d758 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 25 Apr 2012 10:45:32 +0200 Subject: New example, inheritance/polymorphism Also move the inheritance example to inheritance/reuse. --- inheritance/polymorphism/employee.cxx | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 inheritance/polymorphism/employee.cxx (limited to 'inheritance/polymorphism/employee.cxx') 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 + +#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; +} -- cgit v1.1