C++ Dependency Injection