summaryrefslogtreecommitdiff
path: root/mcs/tests/gtest-304.cs
blob: 8f7c71fd5e4a24548e7198b423adf9b0670eb845 (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
//
// Second test from bug 80518
//
using System;

namespace test
{
    public class BaseClass
    {
	public BaseClass()
	{
	}
	public string Hello { get { return "Hello"; } }
    }

    public abstract class Printer
    {
	public abstract void Print<T>(object x) where T: BaseClass;
    } 
    
    public class PrinterImpl: Printer
    {
	public override void Print<T>(object x)
	{
	    Console.WriteLine((x as T).Hello);
	}
    }

    public class Starter
    {
	public static void Main( string[] args )
	{
	    BaseClass bc = new BaseClass();
	    Printer p = new PrinterImpl();
	    p.Print<BaseClass>(bc);
	}	
    }
}