Hi,
I'm working with interfaces, but am unsure on how to go about calling the methods defined in the interface - take the example of the widget/wodget class that is given as an example when an fs file is added:
type IPeekPoke = interface
abstract member Peek: unit -> int
abstract member Poke: int -> unit
end
type wodget = class
val mutable state: int
interface IPeekPoke with
member x.Poke(n) = x.state <- x.state + n
member x.Peek() = x.state
end
member x.HasBeenPoked = (x.state <> 0)
new() = { state = 0 }
end
let a = new wodget();;
Now, if i say a.Peek(), i get an error stating that Peek is not defined. I'm assuming it's just a simple case of getting the syntax right?
Thanks,
Tejus