Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Main {
- public static void main(String[] args) {
- Main m = new Main()
- }
- Main() {
- String[] a = ["Hello world!"]
- Box b = new TextBox(a)
- b.click = {
- content.add("You clicked this box!")
- }
- b.onClick()
- println b.content
- }
- class Box {
- Closure click
- Box () {
- click = {}
- }
- void onClick() {
- click.delegate = this
- click()
- }
- }
- class TextBox extends Box {
- List<String> content
- TextBox (String[] a) {
- super()
- content = a
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement