Created
May 12, 2015 09:14
-
-
Save nickleeh/a5d877e9c62a7d875add to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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