News Feed
Sections




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

DevShed:
Using Subclasses and Accessors with Member Visibility to Protect PHP 5 Class Data
June 05, 2008 @ 07:50:08

DevShed has posted the latest in their series of tutorials covering the scoping keywords in PHP5 (public, private and protected). In this latest edition they work with private values from a parent class.

In the last article, I explained how to work with a couple of private properties that partially comprised the API of a basic class, which is useful for saving simple strings to a specified text file.

This part builds on this previous example but changes up the subclass (an instance of DataSaver) to use what they call an "accessor" - a function in the parent that returns the private variable/contstant's current value when called.

0 comments voice your opinion now!
visibility php5 class privat public protected variable accessor


blog comments powered by Disqus

Similar Posts

DevShed: Decoupling the Validation of Data with Bridge Classes in PHP 5

Gergely Hodicska's Blog: What is new in PHP 5.3 - part 3: mysqlnd

Mike Naberezny's Blog: __get() - an alternative to __autoload()

PHPClasses.org: The Secret PHP Optimization of version 5.4

Helgi\'s Blog: Clash of the Titans


Community Events





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


list laravel developer threedevsandamaybe release series library unittest configure code language wordpress podcast install application bugfix community introduction api interview

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