Consider the following code:
#include "stdafx.h"
#include <iostream>
class Eelement {
public:
static int m_iVal;
};
int Eelement::m_iVal = 33;
int main()
{
//...
return 0;
}
Question:
Why, during the initialization of the static variable m_iVal, I must to precede its name by its type int a second time (first time in class definition) ?
int Eelement::m_iVal = 33;
Why the compiler imposes this syntax which for me looks much more like a double declaration than other things because compiler already knows its type (from the definition of the Element class).