Created
April 26, 2015 13:48
Revisions
-
SteveGilham created this gist
Apr 26, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ [<AbstractClass>] type AbstractPoint = class val mutable vx: int; val mutable vy: int; new(x,y) = { vx = x; vy = y } member p.x with get() = p.vx and set z = p.vx <- z member p.y with get() = p.vy and set z = p.vy <- z abstract move: AbstractPoint -> unit end type Point' = class inherit AbstractPoint new(x,y) = { inherit AbstractPoint(x,y) } override p.move q = p.x <- p.x + q.x; p.y <- p.y + q.y end let p = Point'(2,3) let q = Point'(1,2) p.move(q) p.x p.y;;