Recent changes Random page
GAMING
Technology
 
Gaming
Entertainment
Science Fiction
Biggest wikis
Hobbies
Music
See more...

JavaFX's version of "this"

From Planet JFX

Jump to: navigation, search
 

While instantiating an object with JavaFX's object literal notation, you can declare a "this" variable with a var: statement:

class Parent {
    attribute child: Child;
}

class Child {
    attribute parent: Parent;
}

var aParent = Parent {
    var: myself   // refers to the aParent reference 
                  // (which isn't available for use in the next block)
    child: Child {
        parent: myself
    }
}
println("equal? {aParent == aParent.child.parent}");
Rate this article:
Share this article: