Dependency injection in C++

前端 未结 8 1708
囚心锁ツ
囚心锁ツ 2020-12-13 04:40

This is also a question that I asked in a comment in one of Miško Hevery\'s google talks that was dealing with dependency injection but it got buried in the comments.

<
8条回答
  •  悲&欢浪女
    2020-12-13 05:23

    I've recently been bitten by the DI bug. I think it solves a lot of complexity problems, especially the automated part. I've written a prototype which lets you use DI in a pretty C++ way, or at least I think so. You can take a look at the code example here: http://codepad.org/GpOujZ79

    The things that are obviously missing: no scoping, no binding of interface to implementation. The latter is pretty easy to solve, the former, I've no idea.

    I'd be grateful if anyone here has an opinion on the code.

提交回复
热议问题