diff options
author | Jaime Anguiano Olarra <jaime@mono-cvs.ximian.com> | 2002-12-03 19:38:37 +0300 |
---|---|---|
committer | Jaime Anguiano Olarra <jaime@mono-cvs.ximian.com> | 2002-12-03 19:38:37 +0300 |
commit | c4885b2537b98dcad136bff88d4d3c06ff358b2e (patch) | |
tree | b28de0b250be9aa9aeaa25630a07530be6c9cf89 /mcs/errors/cs0072.cs | |
parent | 835baa2b0f93e4572740dcead0ed2554546c0536 (diff) |
Test for C# Compiler ErrorCS0072. An event can only override another event.
svn path=/trunk/mcs/; revision=9368
Diffstat (limited to 'mcs/errors/cs0072.cs')
-rw-r--r-- | mcs/errors/cs0072.cs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/mcs/errors/cs0072.cs b/mcs/errors/cs0072.cs new file mode 100644 index 00000000000..b297e6daae9 --- /dev/null +++ b/mcs/errors/cs0072.cs @@ -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 () { + } +} + |