2010-10-18 45 views

回答

4
let defaultInstance1<'a when 'a:(new: unit->'a)> = new 'a() 

[<GeneralizableValue>] 
let defaultInstance2<'a when 'a:(new: unit->'a)> = new 'a() 

let x1 = defaultInstance1 // value restriction 
let x2 = defaultInstance2