开发者

Can a static member be overloaded?

type A() =
    static member B() = ()
    static member B(x) = B() //ERROR: Th开发者_StackOverflowe value or constructor 'B' is not defined


When refering to a static member in F#, you need to use the full name (including the name of the type). The F# compiler doesn't automatically look for static members of the current class.

The following should work:

type A() = 
    static member B() = () 
    static member B(x) = A.B()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜