blob: 84cf74295189ceb346f95aae24de3a4b4a975f8e (
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
|
using System;
using SCG = System.Collections.Generic;
public interface IExtensible<T>
{
void AddAll<U> (SCG.IEnumerable<U> items)
where U : T;
}
public abstract class CollectionValueTester<R,S>
where R : IExtensible<S>
{
protected R collection;
}
public class ExtensibleTester<U> : CollectionValueTester<U,int>
where U : IExtensible<int>
{
public ExtensibleTester (U u)
{
this.collection = u;
}
public void Direct()
{
collection.AddAll<int> (new int[] { });
}
}
public class Extensible<V> : IExtensible<V>
{
public void AddAll<W> (SCG.IEnumerable<W> items)
where W : V
{ }
}
class X
{
public static void Main ()
{
Extensible<int> ext = new Extensible<int> ();
ExtensibleTester<Extensible<int>> tester = new ExtensibleTester<Extensible<int>> (ext);
tester.Direct ();
}
}
|