-// cs0072.cs: An event can override anything but another event.
+// CS0072: `Child.OnFoo': cannot override because `ErrorCS0072.OnFoo()' is not an event
// Line: 16
using System;
class ErrorCS0072 {
- delegate void FooHandler ();
- protected void Callback () {
- }
- protected virtual event FooHandler OnFoo;
+ public delegate void FooHandler ();
+ protected void 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 {
+ protected override event FooHandler OnFoo {
add {
- Callback += value;
- //OnFoo += value;
+ OnFoo += value;
}
remove {
- Callback -= value;
- //OnFoo -= value;
+ OnFoo -= value;
}
}