C++ and PHP vs C# and Java - unequal results
问题 I found something a little strange in C# and Java. Let's look at this C++ code: #include <iostream> using namespace std; class Simple { public: static int f() { X = X + 10; return 1; } static int X; }; int Simple::X = 0; int main() { Simple::X += Simple::f(); printf("X = %d", Simple::X); return 0; } In a console you will see X = 11 (Look at the result here - IdeOne C++). Now let's look at the same code on C#: class Program { static int x = 0; static int f() { x = x + 10; return 1; } public