type IVector =
abstract Item : int -> float with get, set
Brian
2010-09-10 02:27:24
You can implement DenseVector without changing the original interface while also providing a setter like this:
type IVector =
abstract Item: int -> float with get
type DenseVector(size : int) =
let data = Array.zeroCreate size
interface IVector with
member this.Item with get i = data.[i]
member this.Item
with get i = (this :> IVector).[i]
and set i value = data.[i] <- value