Dependency injection in C++

前端 未结 8 1683
囚心锁ツ
囚心锁ツ 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:06

    In C++, normally, when you done things right, you don't need to write destructors at all in most cases. You should use smart pointers to delete things automatically. I think, builder don't looks like the owner of the ClassA and ClassB instances. If you don't like to use smart pointers, you should think about objects life time and their owners.

提交回复
热议问题