Consider the following code:
class New {
id = 2;
int id = 7;
}
Obviously it won't compile as we attempt to initialize an undeclared variable.
Encasing the statement into an initialization block, however, makes it compile successfully:
class New {
{ id = 2; }
int id = 7;
}
What is this "feature" of an initialization block that makes this initialization before declaration valid?
Before asking the question I read several posts on initialization blocks on SO, but they seem to mostly address issues on the order of initialization (e.g. static vs non-static).