F#对象在成员之前引用self绑定

时间:2015-06-29 21:31:34

标签: f#

对象在成员定义之前是否可以引用自身?像这样:

type public ClassA () = class
    let b = new ClassB(this)
    member public x.getClassB() = b
    end

其中'this'是对创建ClassB的ClassA实例的引用?

1 个答案:

答案 0 :(得分:6)

类可以使用2010 NON-HISPANIC BLACK MALE HUMAN IMMUNODEFICIENCY VIRUS DISEASE 297 5 2012 NON-HISPANIC BLACK MALE INFLUENZA AND PNEUMONIA 2011 3

在其构造函数中引用自己
as