Groovy: meaning of 'this' inside a closure

后端 未结 4 1921
臣服心动
臣服心动 2021-02-14 12:53

The following example is adapted from \'Groovy in Action\'

class Mother {

    Closure birth() {                            
        def closure = { caller ->         


        
4条回答
  •  孤独总比滥情好
    2021-02-14 13:40

    Sake says, "this is the closure not the object where the closure [is] constructed." But when we run this script, we find that this is a Mother, not a Closure.

提交回复
热议问题