I am wondering if the following code is valid. Static analysis gives an error for this constructor.
Summary: The member variable "A" is initialized by itself.
Summary: The member variable "B" is initialized by itself.
Summary: The member variable 'C' is initialized by itself.
class Foo
{
public:
Foo(int A, int B, int C);
private:
int A;
int B;
int C;
}
Foo::Foo(int A, int B, int C) :
A(A),
B(B),
C(C)
{}
I know this is not a good practice and probably needs to be changed, however I would like to know if the static analysis warning is false and the member variables will be correctly initialized.
source
share