Skip to content

Commit

Permalink
docs: fix inconsistent indentation & more
Browse files Browse the repository at this point in the history
  • Loading branch information
sator-imaging committed Jun 2, 2024
1 parent 9df4728 commit 8f3d95b
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,20 @@ class B {

public static class Test
{
public static void Main()
{
System.Console.WriteLine(A.Value); // 620
System.Console.WriteLine(A.Other); // 310
System.Console.WriteLine(B.Value); // 0 👈👈👈
System.Console.WriteLine(B.Other); // 620
public static void Main()
{
System.Console.WriteLine(A.Value); // 620
System.Console.WriteLine(A.Other); // 310
System.Console.WriteLine(B.Value); // 0 👈👈👈
System.Console.WriteLine(B.Other); // 620
// when changing class member access order, it works correctly 🤣
// see the following for details
//System.Console.WriteLine(B.Value); // 310 👈 correct!!
//System.Console.WriteLine(B.Other); // 620
//System.Console.WriteLine(A.Value); // 620
//System.Console.WriteLine(A.Other); // 310
}
// see the following section for detailed explanation
//System.Console.WriteLine(B.Value); // 310 👈 correct!!
//System.Console.WriteLine(B.Other); // 620
//System.Console.WriteLine(A.Value); // 620
//System.Console.WriteLine(A.Other); // 310
}
}
```

Expand All @@ -94,6 +94,14 @@ public static class Test
- `A.Other = 310;` // initialized here!! this value is not assigned to B.Value


When reading B value first, initialization order is changed and resulting value is also changed accordingly:

- `B.Other = 620;`
- `B.Value = A.Other;`
- `A.Value = B.Other;` // correct: B.Other is initialized before reading value
- `A.Other = 310;`





Expand Down

0 comments on commit 8f3d95b

Please sign in to comment.