I am going back to C++ after spending some time in memory-managed languages, and I\'m suddently kinda lost as to what is the best way to implement dependency injection. (I a
It has been asked before, but my SO search skills are not up to finding it. To summarise my position - you should very rarely, if ever, use references as class members. Doing so causes all sorts of initialisation, assignment and copying problems. Instead, use a pointer or a value.
Edit: Found one - this is a question with a variety of opinions as answers: Should I prefer pointers or references in member data?