Note: this is just an idea, please be gentle ;)
something that irks me is this:
class Foo
{
private:
bool m_bSomeFlag;
CString m_dfltStr;
public:
Foo(bool someFlag, CString dfltStr) :
m_bSomeFlag(someFlag), m_dfltStr(dfltStr)
{ ... }
};
adding/changing one variable declaration that needs such a CTor init requires three places to edit, all with variations of the name.
How VA could help:
Idea 1:
select multimple data members, and provide refactoring option "create initializing constructor". A new constructor is added.
The name of the arguments can be determined from the member names (e.g. stripping m_ or appending underscore).
IMO Default parameters and parameter modifiers are added easily afterwards, so no additional input is needed.
Idea 2:
Add a refactoring option for cosntructors: "Add Member initialization". after some selection of available member(s) (text input? list?), a parameter and the member initialization is added to the constructor. Example:
Foo()
{...}
"Add member initialization for: m_bSomeFlag" changes that to:
Foo(bool bSomeFlag) :
m_bSomeFlag(someFlag)
{...}
I'd prefer the first one - it is simpler an less cases to deal with, but the second one seems a tad more powerful.
Thoughts? Other ideas? Declarations of craziness?