Hey guys, i'm having some trouble with this:
In the object "consumer" i need to do a validation for开发者_StackOverflow the property Nit.
But i don't know where to put this validation.
Do i have to put it where i set the value, In a public function to validate the content before setting the value, or a method inside the object "validateNit"I'm still learning and i have that doubt.
Ty so much for your help, and sorry about the crappy English.
if the property is set just once on initialization, then validate it during object initialization, with a method validateNit. if it can be set/modified at any time with, say, a setNit(newNit) method, you can call validateNit() from setNit().
精彩评论