Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
根据这个页面,一个类的所有抽象成员都必须有一个type-signature. 但我想定义一个具有 void 输入参数和 void 返回类型的抽象类。并且void在这种情况下不是有效的关键字。
type-signature
void
在 F# 中,您通常使用在 C# 中使用关键字的unit类型。void所以你正在寻找的一个例子是:
unit
[<AbstractClass>] type MyAbstractClass() = abstract MyMethod : unit -> unit type MyDerivedClass() = inherit MyAbstractClass() override this.MyMethod() = printf "Do something here..."