0 people like it.

derived ctor fail

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
type BadBaseClass =
    val mutable state : string 
    new () as o = 
        { state = "BadBaseClass" }
           then o.SetState()
    abstract SetState : unit -> unit
    default o.SetState() = ()   

type DerivedFromBad =
    inherit BadBaseClass
    new () as o = 
        { inherit BadBaseClass();  } 
            then o.state <- "DerivedFromBad "
            
    override o.SetState() =
            stdout.WriteLine(o.state)

let b = new DerivedFromBad()
BadBaseClass.state: string
Multiple items
val string : value:'T -> string

Full name: Microsoft.FSharp.Core.Operators.string

--------------------
type string = System.String

Full name: Microsoft.FSharp.Core.string
val o : BadBaseClass
override BadBaseClass.SetState : unit -> unit
abstract member BadBaseClass.SetState : unit -> unit

Full name: Script.BadBaseClass.SetState
type unit = Unit

Full name: Microsoft.FSharp.Core.unit
override BadBaseClass.SetState : unit -> unit

Full name: Script.BadBaseClass.SetState
Multiple items
type DerivedFromBad =
  inherit BadBaseClass
  new : unit -> DerivedFromBad
  override SetState : unit -> unit

Full name: Script.DerivedFromBad

--------------------
new : unit -> DerivedFromBad
Multiple items
type BadBaseClass =
  new : unit -> BadBaseClass
  val mutable state: string
  abstract member SetState : unit -> unit
  override SetState : unit -> unit

Full name: Script.BadBaseClass

--------------------
new : unit -> BadBaseClass
val o : DerivedFromBad
override DerivedFromBad.SetState : unit -> unit

Full name: Script.DerivedFromBad.SetState
val stdout<'T> : System.IO.TextWriter

Full name: Microsoft.FSharp.Core.Operators.stdout
val b : DerivedFromBad

Full name: Script.b
Raw view Test code New version

More information

Link:http://fssnip.net/c2
Posted:14 years ago
Author:
Tags: