blob: 6f3e15cc37c3173b017f8de0e88b699ea4b961f2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include "bootstrap.hpp"
#include "interfaces/enemy.hpp"
#include "interfaces/hero.hpp"
#include <iostream>
int main()
{
auto container = bootstrap();
auto hero = container.get<IHero>();
std::cout << "Created a hero\n";
auto enemy_factory = container.get<IEnemyFactory>();
auto enemy = enemy_factory();
std::cout << "Created a enemy with " << enemy->get_health() << " in health\n";
hero->fight(*enemy);
std::cout << "The hero hit the enemy! The enemy now has " << enemy->get_health()
<< " in health\n";
}
|