aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/cpp/hello-lib.cc
diff options
context:
space:
mode:
Diffstat (limited to 'examples/cpp/hello-lib.cc')
-rw-r--r--examples/cpp/hello-lib.cc21
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