Merge pull request #1861 from saper/home-override
[mono-project.git] / mcs / tests / gtest-039.cs
blob7c94c8acfa3a5c0846da93cc186e71e6a1a4df92
1 //
2 // Important test for the runtime: check whether we're correctly
3 // creating the vtable for nested types.
4 //
6 using System;
8 interface IMonkey<T>
10 T Jump ();
13 class Zoo<T>
15 T t;
17 public Zoo (T t)
19 this.t = t;
22 public T Name {
23 get { return t; }
26 public IMonkey<U> GetTheMonkey<U> (U u)
28 return new Monkey<T,U> (this, u);
31 public class Monkey<V,W> : IMonkey<W>
33 public readonly Zoo<V> Zoo;
34 public readonly W Data;
36 public Monkey (Zoo<V> zoo, W data)
38 this.Zoo = zoo;
39 this.Data = data;
42 public W Jump ()
44 Console.WriteLine ("Monkey {0} from {1} jumping!", Data, Zoo.Name);
45 return Data;
50 class X
52 public static void Main ()
54 Zoo<string> zoo = new Zoo<string> ("Boston");
55 IMonkey<float> monkey = zoo.GetTheMonkey<float> (3.14F);
56 monkey.Jump ();