Daniel
Daniel

Reputation: 47904

Can a static member be overloaded?

type A() =
    static member B() = ()
    static member B(x) = B() //ERROR: The value or constructor 'B' is not defined

Upvotes: 4

Views: 166

Answers (1)

Tomas Petricek
Tomas Petricek

Reputation: 243061

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()

Upvotes: 5

Related Questions