NYCPHP Meetup

NYPHP.org

[nycphp-talk] __get __set methods..

David Mintz dmintz at davidmintz.org
Wed Apr 20 21:47:35 EDT 2005


On Wed, 20 Apr 2005, Adam Maccabee Trachtenberg wrote:

> On Wed, 20 Apr 2005, David Mintz wrote:
> > I might be missing something, but if you want people to be able to get and
> > set your props directly, why not just make them public and be done with
> > it?
>
> Because it breaks encapsulation. Using accessors allows you to modify
> how you store/validate/etc. properties in your class without changing
> the public interface to the data.


Ahh, I see. Fun-duh-mental. So what might look like pro forma
encapsulation today might be another story tomorrow.

Thanks.

---
David Mintz
http://davidmintz.org/



More information about the talk mailing list