所以我有这个简单的代码,我试图找出 F# 中的类和继承:
type Mkp() =
abstract tX : unit -> string
default this.tX() = ""
type A(n : string, v : string) =
inherit Mkp()
member this.n = n
member this.v = v
override this.tX() = sprintf "%s = \"%s\" " this.n this.v
let test = A "first" "second"
let xxx = "" + test.tX
Run Code Online (Sandbox Code Playgroud)
我收到编译器错误:'string' 类型与'unit -> string' 类型不匹配,但我希望 test.tX 是一个字符串,我做错了什么?