All Questions
Tagged with smart-pointer dependency-injection
1 question
27
votes
5
answers
6k
views
C++: Should class own or observe its dependencies?
Say I have a class Foobar that uses (depends on) class Widget. In good ol' days, Widget wolud be declared as a field in Foobar, or maybe as a smart pointer if polymorphic behavior was needed, and it ...