【发布时间】:2013-01-03 19:58:35
【问题描述】:
我有以下代码
public delegate void NotificacaoScanner(NotifScanner e);
// interface
public interface IScanner
{
event NotificacaoScanner onFinalLeitura;
}
// abstract class that implements the interface
public abstract class ScannerGCPerif : IScanner
{
public virtual event NotificacaoScanner onFinalLeitura;
{
add { throw new NotImplementedException("Event not available for this service"); }
remove { throw new NotImplementedException("Event not available for this service"); }
}
}
// concrete class that implements the abstract class
public class ScannerBurroughs : ScannerGCPerif
{
public override event NotificacaoScanner onFinalLeitura;
}
为什么我订阅了ScannerBurroughs实例的onFinalLeitura事件,却坚持执行基类(ScannerGCPerif)的事件声明,异常在哪里?
【问题讨论】:
标签: events inheritance virtual