继承只有私有构造函数的 C# class
Inheriting a C# class that has only a private constructor
我想在我的 F# 代码中子class XMLUnit.NET CompareConstraint
class。
然而,class 只有一个私有构造函数。如果我尝试继承它,我会得到这个编译错误:
This 'inherit' declaration specifies the inherited type but no arguments. Consider supplying arguments, e.g. 'inherit BaseType(args)'.
在 F# 中有没有任何方法可以在没有 public 构造函数的情况下继承 class?
这不是 F# 限制 – 在 任何 .NET 语言中无法从仅具有私有构造函数的类型继承。
我想在我的 F# 代码中子class XMLUnit.NET CompareConstraint
class。
然而,class 只有一个私有构造函数。如果我尝试继承它,我会得到这个编译错误:
This 'inherit' declaration specifies the inherited type but no arguments. Consider supplying arguments, e.g. 'inherit BaseType(args)'.
在 F# 中有没有任何方法可以在没有 public 构造函数的情况下继承 class?
这不是 F# 限制 – 在 任何 .NET 语言中无法从仅具有私有构造函数的类型继承。