Is there a way to generate a warning when a derived class member variable name shadows one of its parents class, e.g
class Mother
{
public:
Mother() : i(0
I actually saw code as follows which shows the necessity of the shadow warnings.
int val = 0;
if (flag == aval)
int val = firstval;
else if (flag == bval)
int val = secondval;
else if
.
.
.
switch (val)
{
// put cases here
}
I have also seen shadow warnings where the inside variable was meant to be local, have no effect on the outside variable, and the shadowed variable was not supposed to be referenced. Actually, it was easier to just change the name to prevent the warning.