考虑两个抽象类 alpha 和 beta:
[<AbstractClass>]
type alpha () =
abstract member foo: beta->beta
[<AbstractClass>]
and beta () = //***
abstract member bar: alpha
如果我尝试编译我得到一个错误,在 * * * 指示的行上:
error FS0010: Unexpected keyword 'and' in interaction
如果我写:
[<AbstractClass>]
type alpha () =
abstract member foo: beta->beta
and beta () =
abstract member bar: alpha
然后我得到:
error FS0365: No implementation was given for 'abstract member beta.bar : alpha'
以及我应该添加 AbstractClass 属性的提示
那么如何声明循环定义的抽象类呢?