Given a new class:
class MyClass
{
public:
MyClass();
protected:
int a;
char* b;
AnotherClass c;
const short d;
};
I would love to right-click the MyClass() constructor and have an option to "Create Implementation with member variables set to defaults". That might look like either:
MyClass::MyClass()
: a(0)
, b(nullptr)
, c(AnotherClass())
, d(0)
{}
or
MyClass::MyClass()
: d(0)
{
a = 0;
b = nullptr;
c = AnotherClass();
}
Or whatever each type's default would be. Granted, const variables need to be initialized in constructors, and there is always the worry of weird edge cases, but just being able to throw all these member variables into a constructor would make it easier to remember to initialize everything properly (ever forget to set or null a pointer that you declared somewhere?).