Class Age {
private int value = null;
public boolean SetValue(int value) {
if (value >= 0 && value <= 150) {
this.value = value;
return true;
}
return false;
}
public int getValue() {
return this.value;
}
}That's approximately what the equivalent would look like in any language that supports classes (any errors are because it was typed on my phone). Being able to do that in 1 line would be much more convenient. That's why most programmers working in those languages just define age as an int and move on.