【发布时间】:2011-05-16 03:26:54
【问题描述】:
我对 FxCop 和警告有疑问:Abstract types should not have constructors。
这是为许多抽象类显示的(可能全部,我还没有检查过)。当我看起来他们中的大多数人都没有新方法时,所以我认为是编译器添加了一个默认方法。因此,要删除它,我添加了一个私有默认构造函数 (Private Sub New()),这意味着所有继承类都无法构建并出现错误:
Class 'InheritingClass' has no accessible 'Sub New' and cannot be inherited.
这似乎很奇怪,因为 FxCop 不请求公共构造函数,但是当我删除它时构建失败。
【问题讨论】:
标签: .net vb.net fxcop abstract