blob: 1b54dc54995286e8f7711a1940a6516acd716b65 (
plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
//
// Another important test: nested generic types.
//
using System;
class Queue<T>
{
public Queue (T first, T second)
{
head = new Node<T> (null, second);
head = new Node<T> (head, first);
}
protected Node<T> head;
protected Node<T> GetFoo ()
{
return head;
}
protected Node<T> Foo {
get {
return GetFoo ();
}
}
protected void Test (T t)
{
Console.WriteLine (t);
}
public void Test ()
{
Test (head.Item);
Test (head.Next.Item);
Test (GetFoo ().Item);
Test (Foo.Item);
}
protected class Node<U>
{
public readonly U Item;
public readonly Node<U> Next;
public Node (Node<U> next, U item)
{
this.Next = next;
this.Item = item;
}
}
}
class X
{
public static void Main ()
{
Queue<int> queue = new Queue<int> (5, 9);
queue.Test ();
}
}
|