Skip to content

Instantly share code, notes, and snippets.

@nickleeh
Created May 12, 2015
Embed
What would you like to do?
type Duck () =
member this.sayQuack = printfn "quack, quack..."
type Bird () =
member this.sayQuack = printfn "tweet, tweet..."
type Dog () =
member this.bark = printfn "woof, woof..."
let duck = Duck()
let bird = Bird()
let dog = Dog()
duck.sayQuack
bird.sayQuack
dog.bark
// dog.sayQuack (* VS would underline error in red: 'sayQuack' is not defined. *)
(* output:
quack, quack...
tweet, tweet...
woof, woof...
val it : unit = ()
*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment