2004-03-01 Larry Ewing <lewing@ximian.com>
[mono-project.git] / mcs / tests / gen-39.cs
blob4c859b2b3db0027dec0fedec35156f077379a341
1 using System;
3 interface IMonkey<T>
5 T Jump ();
8 class Zoo<T>
10 T t;
12 public Zoo (T t)
14 this.t = t;
17 public T Name {
18 get { return t; }
21 public IMonkey<U> GetTheMonkey<U> (U u)
23 return new Monkey<T,U> (this, u);
26 public class Monkey<V,W> : IMonkey<W>
28 public readonly Zoo<V> Zoo;
29 public readonly W Data;
31 public Monkey (Zoo<V> zoo, W data)
33 this.Zoo = zoo;
34 this.Data = data;
37 public W Jump ()
39 Console.WriteLine ("Monkey {0} from {1} jumping!", Data, Zoo.Name);
40 return Data;
45 class X
47 static void Main ()
49 Zoo<string> zoo = new Zoo<string> ("Boston");
50 IMonkey<float> monkey = zoo.GetTheMonkey<float> (3.14F);
51 monkey.Jump ();