News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Stefan Mischook's Blog:
A Question about object properties in PHP Classes
December 07, 2007 @ 14:33:00

Stefan Mischook shares a little question and answer he had recently concerning object properties in PHP.

The question asked about accessing properties outside the class and/or defining them as protected/private to prevent it. Stefan's response was basically:

Many OO techniques are designed for situations where you will have more than one programmer involved, now or later. By declaring variables as protected or private, you are adding security to the code base by forcing the use of getter and setter methods where you can control how objects are used.
0 comments voice your opinion now!
properties classes object private protected properties classes object private protected


blog comments powered by Disqus

Similar Posts

Zend Developer Zone: ZendCon 2010 Podcast - A New Approach to Object Persistence in PHP

Vito Chin's Blog: Session-based object instantiation with memcached

Refulz.com: The __toString() Method - Objects as Strings

Leszek Stachowski's Blog: php anachronic coding standards

Cocoliso's Blog: Adding A Syntax Highlighter To Your Site: The Power Of Geshi


Community Events

Don't see your event here?
Let us know!


release interview library voicesoftheelephpant laravel xdebug api unittest opinion example php7 community install introduction laravel5 language podcast extension series framework

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework