【发布时间】:2010-10-15 05:04:11
【问题描述】:
我有一个实现 3 个接口的抽象类。
public abstract class ServiceBaseCore<Entity, EntityKey> : MarshalByRefObject, IComponentService, IEntityProvider<Entity, EntityKey>
where Entity : IEntityId<EntityKey>, new()
where EntityKey : IEntityKey, new()
{
// Provided functionality/body to some methods of interface
}
问题:我收到错误消息,我的抽象类没有为接口的函数提供实现(定义/主体),而我读到的是“如果一个类是抽象的,那么就不需要向所有人提供主体/其实现的接口的任何功能”。
注意:代码是由 codeSmith 生成的,即使它显示错误。
请告诉我我哪里错了,我错过了什么。
谢谢
【问题讨论】:
-
只需要在抽象类中将接口方法标记为抽象即可。
标签: c# interface abstract-class