class Test {
public:
int xyz=10;
};
Why does the compilation fail in c++?
You should initialize members with a constructor. See this thread: in-class initialization of non-static and non-const members for good information.
It is not a static member so initialize it in constructor.Non static member cannot be initialize without constructor
Also see this for further details about the initialization of static and non staic data