Consider the interface:
type IVector =
abstract Item : int -> float
Now define the class:
type DenseVector(size : int) =
let mutable data = Array.zeroCreate size
interface IVector with
member this.Item with get n = data.[n]
How to provide a method for changing the nth record of a dense vector? Then it would be nice to change the above code as:
type DenseVector(size : int) =
let mutable data = Array.zeroCreate size
interface IVector with
member this.Item with get n = data.[n]
and set n value = data.[n] <- value
However, I get the following error due to the signature of the abstract method Itemin the interface IVector:
No abstract property was found that matches this override.
So what should be the signature Itemin IVector?
Allan source
share