2010-02-20 Zoltan Varga <vargaz@gmail.com>
[mcs.git] / tests / test-115.cs
blob02b630e0225f14424756f8bb966eaee24fe63e90
1 //
2 // This is a compile test, submitted by Joe. We really need
3 // a more thorough set of tests for the user defined explicit
4 // conversions
5 //
6 using System;
8 class A {
9 public static explicit operator X (A foo)
11 X myX = new X();
13 return myX;
17 class X {
20 class Y : X {
23 class blah {
24 public static int Main ()
26 A testA = new A();
28 X testX = (X) testA;
30 try {
31 Y testY = (Y) testA;
32 } catch (InvalidCastException){
33 return 0;
37 // We should have thrown the exception above
39 return 1;