Grade:
type NotAbstract () =
member this.WithOptionalParameters (x, ?y) =
let y = defaultArg y 10
x + y
has the following type signature:
type NotAbstract =
class
new : unit -> NotAbstract
member WithOptionalParameters : x:int * ?y:int -> int
end
However, this does not work:
[<AbstractClass>]
type AbstractExample () =
abstract WithOptionalParameters: int * ?int -> int
type NotAbstract () =
inherit AbstractExample ()
override this.WithOptionalParameters (x, ?y) =
let y = defaultArg y 10
x + y
How to write the correct type signature in an abstract function definition with additional parameters? I did not find any clues here .
PS: I know that a (similar) result can be achieved using polymorphism
source
share