![]() |
|
|
|
|
|
|
2
23rd November 18:20
External User
Posts: 1
|
If it's a public member variable there is no need for plain accessor
methods - they add no value. I feel the same about private variables with plain get and set accessors, there's just no point unless the accessors are doing more than setting and getting the internal variable. -Stut -- http://stut.net/ |
|
|
4
23rd November 18:21
External User
Posts: 1
|
In my experience that's pretty rare, but your mileage may vary. If it
does happen you can simply implement __get and __set magic methods, which is far better from a code maintainability point of view than littering the class with pointless accessor methods just in case (IMHO). -Stut -- http://stut.net/ |
|
|
7
23rd November 18:21
External User
Posts: 1
|
Accessor methods. They allow for changes in the future that may well
be unforeseen at the moment. Or at least that would be my response with PHP4. Now with the __get and __set built-in accessors, that's pretty much taken care of. Not tried this, but you may be able to do it with a __get method that doesn't return anything. -- Richard Heyes http://www.phpguru.org |
|
| Some other forums that might be of your interest : Php 5 forum, Apache forum, Iis forum, Functions forum, Classes forum, Librarys forum, Bugs forum, Postgres forum, Mysql forum, Paradox forum, Ms sql forum, Configurations forum, Php.ini forum, Problems forum, Scripting forum, Css forum, General forums, Off-topic talk, Links, Extra forums, Php |