|
|
|
|
|
by vips7L
673 days ago
|
|
With proper OO you could still implement that on the user object. boolean isAdult() {
return this.age >= this.location.ageOfAdulthood();
// or this.location.isAdult(this.age); pick your poison!
}
…anyway it’s just an example of how to introduce OO concepts. As everything in programming it depends |
|
* You may need to determine adulthood for a different jurisdiction than where the person currently resides. Their citizenship may be elsewhere, or you may be running a report that expects "adulthood" to be by some other region's standards, etc.
* Sometimes the underlying kind of adult-need wanted is slightly different, like for consuming alcohol or voting.
* There may be a weird country or province has laws that need additional factors, like some odd place where it's a different age-cutoff for men and women.