Groovy里的Optional函数可以不像C++那样,一定得放在参数列表的最后,这个是一大改进
class Person{
def age, name
Person(n="buhaiqing", a ){
name =n
age = a
}
}
def o = new Person(23)
def hello = { p -> println "name is ${p.name} and age is ${p.age}"}
hello(o)