Classes
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
If a property must be a certain type, yes, I believe it should have a get/set. If the property is a "public" or "protected" one, I generally believe they should have a get/set. If it should be read only, you should only have only a get available for the outside, while authentication should be used on the set method. On private variables, I don't think they are necessary unless there needs to be some form of processing done whenever it's accessed.. This follows the instances I listed previously..
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
.... and if you're running PHP4 it doesn't really make much difference other than the first sentencefeyd wrote:If a property must be a certain type, yes, I believe it should have a get/set. If the property is a "public" or "protected" one, I generally believe they should have a get/set. If it should be read only, you should only have only a get available for the outside, while authentication should be used on the set method. On private variables, I don't think they are necessary unless there needs to be some form of processing done whenever it's accessed.. This follows the instances I listed previously..
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
true, 5 introduced a lot more support for "standard" OOP support found in many languages, but there is still more work to be done.. 5.1 greatly increased the speed at which PHP could parse and render the code, along with objects, but still has some of the flaws of it's major version (which are being worked on..)