Whole document tree 12. Object Oriented Features - public, private, protectedPHP scripting language provides object oriented features through the class keyword. Features like public, private and protected will be supported in the future release (they are in TODO list). In the meantime, you can use the following coding conventions to distinguish between private, public and protected variables:
class someabc { var $_conn; // Private variable var $_Tmyvar; // Protected variable var $connMYCONNECTION; // Public variable var $connToDb; // Public variable var $myvar3; // Public variable var $myvarTHISTEST; // Public variable function _foofunction() {} // Private function function _Tfoofunction() {} // Protected function function foofunction() {} // Public function } The private, protected declarations provide the encapsulation and data-hiding. But you must consider the following disadvantages of encapsulation:
Next Previous Contents |