Dependency injection: Difference between revisions

Content deleted Content added
Xilef97 (talk | contribs)
m C++: fix typo: wrong type was used for the member variable, code wouldn't compile
 
(One intermediate revision by one other user not shown)
Line 310:
class DatabaseService {
private:
DatabaseServiceDatabaseConnection& dbConn;
public:
explicit DatabaseService(DatabaseConnection& db):
Line 346:
class DatabaseConnection: public IConnection {
public:
DatabaseConnection() = default;
 
void connect() override {
std::println("Connecting to database...");
Line 355 ⟶ 357:
std::shared_ptr<IConnection> conn;
public:
DatabaseService() = default;
 
void setConnection(std::shared_ptr<IConnection> nextConn) noexcept {
conn = nextConn;