Am I using initializer lists correctly in my class? There seems to be a lot of code duplication. If I needed another variable, I'd have to add it in three places.
class MyClass {
public:
MyClass(
anotherClass _a,
std::string _b,
std::string _c,
float _d
)
: a(_a),
b(_b),
c(_c),
d(_d)
{ }
private:
anotherClass a;
std::string b;
std::string c;
float d;
};
Aucun commentaire:
Enregistrer un commentaire