diff options
Diffstat (limited to 'examples/basic/src/interfaces')
-rw-r--r-- | examples/basic/src/interfaces/enemy.hpp | 11 | ||||
-rw-r--r-- | examples/basic/src/interfaces/hero.hpp | 11 | ||||
-rw-r--r-- | examples/basic/src/interfaces/weapon.hpp | 9 |
3 files changed, 31 insertions, 0 deletions
diff --git a/examples/basic/src/interfaces/enemy.hpp b/examples/basic/src/interfaces/enemy.hpp new file mode 100644 index 0000000..45e004f --- /dev/null +++ b/examples/basic/src/interfaces/enemy.hpp @@ -0,0 +1,11 @@ +#pragma once + +class IEnemy +{ +public: + virtual ~IEnemy() noexcept = default; + + virtual int get_health() const noexcept = 0; + + virtual void do_damage(int damage) noexcept = 0; +}; diff --git a/examples/basic/src/interfaces/hero.hpp b/examples/basic/src/interfaces/hero.hpp new file mode 100644 index 0000000..25e18fc --- /dev/null +++ b/examples/basic/src/interfaces/hero.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "interfaces/enemy.hpp" + +class IHero +{ +public: + virtual ~IHero() noexcept = default; + + virtual void fight(IEnemy &enemy) noexcept = 0; +}; diff --git a/examples/basic/src/interfaces/weapon.hpp b/examples/basic/src/interfaces/weapon.hpp new file mode 100644 index 0000000..7404115 --- /dev/null +++ b/examples/basic/src/interfaces/weapon.hpp @@ -0,0 +1,9 @@ +#pragma once + +class IWeapon +{ +public: + virtual ~IWeapon() noexcept = default; + + virtual int get_strength() const noexcept = 0; +}; |