Interface

A set of abstract members that would be implemented in a Class.

Interface:

1: 
2: 
type IPrintable =
  abstract member Print: unit -> unit

Implementation:

1: 
2: 
3: 
type SomeClass(x: int, y: float) =
  interface IPrintable with
    member this.Print() = printfn "%d %f" x y

Interface methods can only be called through the interface by upcasting (:>):

1: 
2: 
let x1 = SomeClass(1, 2.0)
(x1:> IPrintable).Print()

Alternatively, declare a method on the object that does the upcast:

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
type SomeClass2(x: int, y: float) =
  member this.Print() = (this:> IPrintable).Print()
  interface IPrintable with
    member this.Print() = printfn "%d %f" x y

let x2 = SomeClass2(1, 2.0)
x2.Print()

// TODO: Interfaces using Object Expressions

// TODO: Interface Inheritance