Test for C# Compiler ErrorCS0072. An event can only override another event.
authorJaime Anguiano Olarra <jaime@mono-cvs.ximian.com>
Tue, 3 Dec 2002 16:38:37 +0000 (16:38 -0000)
committerJaime Anguiano Olarra <jaime@mono-cvs.ximian.com>
Tue, 3 Dec 2002 16:38:37 +0000 (16:38 -0000)
svn path=/trunk/mcs/; revision=9368

mcs/errors/cs0072.cs [new file with mode: 0644]

diff --git a/mcs/errors/cs0072.cs b/mcs/errors/cs0072.cs
new file mode 100644 (file)
index 0000000..b297e6d
--- /dev/null
@@ -0,0 +1,31 @@
+// cs0072.cs: An event can override anything but another event.
+// Line: 16
+
+using System;
+
+class ErrorCS0072 {
+       delegate void FooHandler ();
+       protected void Callback () {
+       }
+       protected virtual event FooHandler OnFoo;
+}
+
+class Child : ErrorCS0072 {
+       // We are trying to override a method with an event.
+       // To get this right comment the next line and uncomment the others below.
+       protected override event FooHandler Callback {
+       //protected override event FooHandler OnFoo {
+               add {
+                       Callback += value;
+                       //OnFoo += value;
+               }
+               remove {
+                       Callback -= value;
+                       //OnFoo -= value;
+               }
+       }
+
+       public static void Main () {
+       }
+}
+