tester ce bout de code
Pourquoi ca donne ce résultat?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace TestConsole { public abstract class Foo { static Foo() { Console.Write("Constructeur Foo"); } public static string Instance; public static void SetInstance(string ins) { Instance = ins; } } public class Bar : Foo { static Bar() { Console.Write("constructeur Bar"); SetInstance("hello word"); } } class Program { static void Main(string[] args) { Console.Write(Bar.Instance + "opps"); } } }
Partager