Saturday, February 16, 2013

Calling constructor of superclass in F#

(In learning from "Programming F# 3.0, 2nd Edition")

> open System.Globalization;;
> type AncientCalendar<'a> =
-   inherit JulianCalendar
-   val m_subfield : 'a
-   new(subfield) =
-     {
-       inherit JulianCalendar()
-       m_subfield = subfield
-     };;

type AncientCalendar<'a> =
  class
    inherit JulianCalendar
    new : subfield:'a -> AncientCalendar<'a>
    val m_subfield: 'a
  end

No comments:

Post a Comment