16
1
type IA =
2
abstract Action : unit -> unit
3
4
type Product =
5
| ProductA
6
| ProductB
7
8
let factory = function
9
| ProductA -> { new IA with
10
member this.Action() = printfn "Product A" }
11
| ProductB -> { new IA with
12
member this.Action() = printfn "Product B" }
13
14
let creators = [|factory Product.ProductA; factory Product.ProductB|]
15
16
creators |> Array.iter (fun x -> x.Action() )
10
10
>
10