I added my own getter and setter to a variable:
class Person{
private var age = 0
def currentAge = age
def currentAge_=(age: Int) = this.age = age
}
Looking at compiled version gives:
public class Person implements scala.ScalaObject {
private int age;
private int age();
private void age_$eq(int);
public int currentAge();
public void currentAge_$eq(int);
public Person();
}
I want to avoid automatic generation of default getter and setter. Is it possible?
private[this] var age = 0
so that age
is only visible to the instance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With