01:
02: class MaClasse
03: {
04: private Modifier<int> modifier;
05: private int counter;
06:
07: public MaClasse ()
08: {
09: this.modifier = new Modifier<int> (this.counter);
10: this.counter = 3;
11: }
12:
13: public void Test ()
14: {
15: Console.WriteLine ("avant: " + this.counter); // devrait afficher "avant: 3"
16:
17: this.modifier.SetValue (12);
18:
19: Console.WriteLine ("apr�s: " + this.counter); // devrait afficher "apr�s: 12"
20: }
21: }
22:
23: class Modifier<T>
24: {
25: // attributs ?
26: private /*FIXME*/ myRef;
27:
28: public Modifier (ref T myVar)
29: {
30: myRef = /*FIXME*/;
31: }
32:
33: public void SetValue (T value)
34: {
35: this.myRef = value;
36: }
37: }