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
Post a Comment