Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class A(var t: Int){
- def apply() = t
- def update(printValue: Boolean, newValue: Int):Unit = {
- if (printValue) {
- println(newValue)
- }
- t = newValue
- }
- }
- val a = new A(1)
- a() эквивалентно a.apply()
- a(true) = 2 эквивалентно a.update(true, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement