aboutsummaryrefslogtreecommitdiff
path: root/examples/basic/src/hero.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/basic/src/hero.cpp')
-rw-r--r--examples/basic/src/hero.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/examples/basic/src/hero.cpp b/examples/basic/src/hero.cpp
new file mode 100644
index 0000000..7348982
--- /dev/null
+++ b/examples/basic/src/hero.cpp
@@ -0,0 +1,10 @@
+#include "hero.hpp"
+
+#include <utility>
+
+Hero::Hero(std::shared_ptr<IWeapon> weapon) noexcept : _weapon(std::move(weapon)) {}
+
+void Hero::fight(IEnemy &enemy) noexcept
+{
+ enemy.do_damage(_weapon->get_strength());
+}