java - How do getters and setters work? -




i'm php world. explain getters , setters , give examples?

tutorial not required this. read on encapsulation

private string myfield; //"private" means access restricted  public string getmyfield() {      //include validation, logic, logging or whatever here     return this.myfield; } public void setmyfield(string value) {      //include more logic      this.myfield = value; } 




wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -