3 public static class Driver
5 delegate void SimpleDelegate ();
11 public virtual void OnEvent ()
13 Console
.WriteLine ("VirtualDelegate0.OnEvent (error!)");
18 class VirtualDelegate1
: VirtualDelegate0
20 public override void OnEvent ()
22 Console
.WriteLine ("VirtualDelegate1.OnEvent");
26 class NonVirtualDelegate
28 public void OnEvent ()
30 Console
.WriteLine ("NonVirtualDelegate.OnEvent");
34 static bool check (SimpleDelegate d
)
41 public static int Main ()
43 SimpleDelegate dv
= new SimpleDelegate (new VirtualDelegate1 ().OnEvent
);
44 SimpleDelegate dnv
= new SimpleDelegate (new NonVirtualDelegate ().OnEvent
);
48 if (!check (dnv
+ dv
))
50 if (!check (dv
+ dnv
))
52 if (!check (dnv
+ dnv
))