2009-03-11 Zoltan Varga <vargaz@gmail.com>
[mcs.git] / tests / gtest-040.cs
blobbcaeef3d0c901ce2108bd5f5cc2e25863ec438d5
1 public interface INode<T>
3 void Hello (T t);
6 public class Stack<T>
8 public T TheData;
9 public readonly Foo<T> TheFoo;
11 public Stack (T t)
13 this.TheData = t;
14 this.TheFoo = new Foo<T> (t);
17 public INode<T> GetNode ()
19 return new Node (this);
22 public Foo<T> GetFoo (T t)
24 return new Foo<T> (t);
27 public Bar<T> GetBar (T t)
29 return new Bar<T> (t);
32 protected class Node : INode<T>
34 public readonly Stack<T> Stack;
36 public Node (Stack<T> stack)
38 this.Stack = stack;
41 public void Hello (T t)
46 public class Foo<T>
48 public readonly T Data;
50 public Bar<T> GetBar ()
52 return new Bar<T> (Data);
55 public Foo (T t)
57 this.Data = t;
61 public class Bar<U>
63 public readonly U Data;
65 public Bar (U u)
67 this.Data = u;
70 public Foo<T> GetFoo (Stack<T> stack)
72 return stack.TheFoo;
75 public class Baz<V>
77 public readonly V Data;
79 public Foo<T> GetFoo (Stack<T> stack)
81 return new Foo<T> (stack.TheData);
84 public Bar<V> GetBar ()
86 return new Bar<V> (Data);
89 public Baz (V v)
91 this.Data = v;
96 public void Test ()
98 Stack<T>.Foo<T> foo1 = GetFoo (TheData);
99 Foo<T> foo2 = GetFoo (TheData);
101 Stack<long>.Foo<T> foo3 = new Stack<long>.Foo<T> (TheData);
102 Stack<long>.Foo<float> foo4 = new Stack<long>.Foo<float> (3.14F);
104 Foo<double> foo5 = new Foo<double> (3.14);
108 class X
110 static void Main ()
112 Stack<int> stack = new Stack<int> (1);
113 INode<int> node = stack.GetNode ();
114 Stack<int>.Foo<int> foo = stack.GetFoo (7);
115 Stack<int>.Bar<int> bar = stack.GetBar (8);