这是一些示例代码
type IBaz = abstract member Baz : int -> int [] type MyAbsClass() = // abstract abstract member Foo : int -> int // virtual (abstract with default value) abstract member Bar : string -> int default this.Bar s = s.Length // concrete member this.Qux x = x + 1 // a way to implement an interface abstract member Baz: int -> int interface IBaz with member this.Baz x = this.Baz x type MySubClass(z : int) = inherit MyAbsClass() override this.Foo x = x + 2 override this.Bar s = (base.Bar s) - 1 override this.Baz x = x + 100 member this.Z = z new () = MySubClass(0) let c = new MySubClass(42) printfn "%d %d %d %d %d" c.Z (c.Foo 40) (c.Bar "two") (c.Qux 41) (c.Baz 42000)