Partager via


F# Object Oriented Programming

Jomo Fisher—F# has a functional heritage but it is actually very good at OO as well.  Here’s an example of its nice, clean syntax for declaring a class:

Code Snippet

  1. type Vector(x : float, y : float) =
  2.     member this.X = x
  3.     member this.Y = y

Tim Ng posted a nice comparison of F# to C# for OO language features. If you’re a C# programmer interested in F#, this is a great place to start.

 

This posting is provided "AS IS" with no warranties, and confers no rights.