diff options
Diffstat (limited to 'examples/cpp/hello-lib.cc')
-rw-r--r-- | examples/cpp/hello-lib.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/cpp/hello-lib.cc b/examples/cpp/hello-lib.cc new file mode 100644 index 0000000000..8e40921cee --- /dev/null +++ b/examples/cpp/hello-lib.cc @@ -0,0 +1,21 @@ +#include "examples/cpp/hello-lib.h" + +#include <iostream> + +using std::cout; +using std::endl; +using std::string; + +namespace hello { + +HelloLib::HelloLib() : HelloLib("Hello") { +} + +HelloLib::HelloLib(const string& greeting) : greeting_(new string(greeting)) { +} + +void HelloLib::greet(const string& thing) { + cout << *greeting_ << " " << thing << endl; +} + +} // namespace hello |