Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-164.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9f08f01d10612eab98372fbcd343f12dcd934857 (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;

class X
{
	protected virtual int Foo ()
	{
		return 1;
	}

	protected delegate int FooDelegate ();
	protected FooDelegate foo;

	protected X ()
	{
		foo = new FooDelegate (Foo);
	}
}

class Y : X
{
	protected Y ()
		: base ()
	{ }

	protected override int Foo ()
	{
		return 2;
	}

	int Hello ()
	{
		return foo ();
	}

	public static void Main ()
	{
		Y y = new Y ();
		int result = y.Hello ();

		if (result == 2)
			Console.WriteLine ("OK");
		else
			Console.WriteLine ("NOT OK");
	}
}