зеркало из
https://github.com/iharh/notes.git
synced 2025-10-30 05:06:05 +02:00
18 строки
357 B
Plaintext
18 строки
357 B
Plaintext
by default in groovy:
|
|
attributes - are private
|
|
methods - are public
|
|
classes - are public
|
|
|
|
class Person {
|
|
String first
|
|
String last
|
|
}
|
|
|
|
Person qb = new Person()
|
|
qb.setFirst('Tom')
|
|
qb.last = 'Brady' // use auto-generated setLast-method, unless the prop is private
|
|
println "${qb.getFirst()} ${qb.last}"
|
|
|
|
...
|
|
new Person(first: 'Tom', last: 'Brady')
|