using GLib; public class Foo : Object { public int data { get; construct; } public Foo (construct int data) { } } public class FalseFoo : Object { } public class FooBar : Foo { public FooBar (int data) { this.data = data; } } public class App : Object { static int main (string[] args) { /* OK implitic cast is good */ Foo foo = new FooBar (1); /* ERROR Should require explicit cast ? */ FooBar foobar = new Foo (1); /* OK explicit cast required */ foobar = (FooBar) foo; /* ERROR Should require explicit cast and fail on compatibility */ Foo foo1 = new FalseFoo (); /* ERROR should fail on compatible type */ FalseFoo falsefoo = (FalseFoo) foo; /* Silently accept null cast ? */ foobar = null; foo = (Foo) foobar; /* Nullexception */ foo.data = 5; /* OK foreach implicit upcast */ foreach (Foo item in new FooBar[3]) { } /* ERROR should require explicit cast, not allowed in foreach */ foreach (FooBar item in new Foo[3]) { } return 0; } }