Skip to content

Instantly share code, notes, and snippets.

@nickleeh
Created May 12, 2015 09:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickleeh/a5d877e9c62a7d875add to your computer and use it in GitHub Desktop.
Save nickleeh/a5d877e9c62a7d875add to your computer and use it in GitHub Desktop.
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