aboutsummaryrefslogtreecommitdiff
path: root/examples/basic/src/bootstrap.cpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-04-29 20:51:15 +0200
committerHampusM <hampus@hampusmat.com>2022-04-29 20:51:15 +0200
commit376ef270b255256b4154eafaea3530ab01e7ccc5 (patch)
tree823d4ffa69890e89b5d887e9751bffa49078702f /examples/basic/src/bootstrap.cpp
parent41866b0febe36ca2f7d6c02ffce0ffea3f0ce425 (diff)
docs: add factory to basic examplev0.1.2
Diffstat (limited to 'examples/basic/src/bootstrap.cpp')
-rw-r--r--examples/basic/src/bootstrap.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/examples/basic/src/bootstrap.cpp b/examples/basic/src/bootstrap.cpp
index fe59c5d..38edcc3 100644
--- a/examples/basic/src/bootstrap.cpp
+++ b/examples/basic/src/bootstrap.cpp
@@ -16,7 +16,13 @@ yacppdic::Container bootstrap()
container.bind<IHero>().to<Hero>();
container.bind<IWeapon>().to<Sword>();
- container.bind<IEnemy>().to<Enemy>();
+
+ container.bind<IEnemyFactory>().to_factory(
+ []()
+ {
+ return std::make_unique<Enemy>();
+ }
+ );
return container;
}