【发布时间】:2022-01-13 11:15:33
【问题描述】:
假设我在 F# 中有以下界面:
type InterfaceA =
abstract Magic : InterfaceA -> InterfaceA
如何实现这样的接口? 当我尝试这样做时:
type MyTypeA = {x:int} with
interface InterfaceA with
member self.Magic another =
{x=self.x+another.x}
我收到错误:
This expression was expected to have type 'InterfaceA' but here has type 'MyTypeA'
【问题讨论】:
标签: interface f# interface-implementation