blob: 648bc6f7cec5f9a2cd0483f3838a7eb075004ead (
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
|
using System.Collections.Generic;
namespace Test
{
public abstract class Base
{
public virtual IEnumerable<Base> GetStuff (int a)
{
yield return this;
}
}
public abstract class Derived : Base
{
public override IEnumerable<Base> GetStuff (int a)
{
foreach (var x in base.GetStuff (a))
yield return x;
}
}
public class SpecialDerived : Derived
{
public override IEnumerable<Base> GetStuff (int a)
{
foreach (var x in base.GetStuff (a))
yield return x;
}
public static void Main ()
{
Base b = new SpecialDerived ();
foreach (var a in b.GetStuff (5)) {
}
}
}
}
|