quiz

SOLID C++ Quiz

Mastery Check

stars 0/12
SRP - Single Responsibility Question 2 of 12

Which method in this `User` class violates SRP the most?

class User {
    string name;
public:
    void changeName(string newName) { name = newName; }
    void saveToPostgresDB() { 
        // Direct SQL connection code...
    }
    string getName() const { return name; }
};