PHP
  Home arrow PHP arrow More on Private Methods with PHP 5 Mem...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Moblin 
JMSL Numerical Library 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

More on Private Methods with PHP 5 Member Visibility
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2008-06-25

    Table of Contents:
  • More on Private Methods with PHP 5 Member Visibility
  • Reintroducing a previous hands-on example
  • Calling a private method from a subclass
  • Another way to protect class methods: the final keyword

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    More on Private Methods with PHP 5 Member Visibility


    (Page 1 of 4 )

    Welcome to the final chapter of the series, “Protecting the data of PHP 5 classes with member visibility.” Complemented by copious illustrative examples, this article series guides you through learning the key concepts regarding the use of public, protected, and private data members within PHP 5 classes. This way you can start defining the visibility of the properties and methods of your own classes in a very short time.

    Frankly speaking, one of the most useful features introduced into the object model of PHP 5 is “member visibility.” This comes in handy for specifying whether the data members of a certain class will be public, protected. or private.

    At a glance, determining the visibility of methods and properties of a given class may seem like a pretty straightforward process that can be tackled with minor hassles. However, when building object-oriented applications that work in real-world conditions, this procedure can be challenging.

    Thus, if you’re a PHP developer who wants to learn in an easy way to work with public, protected, and private class members when using PHP 5, then you should start reading this article now!

    Now that you've been introduced to the main subject of this series, it’s an excellent time to recapitulate the group of topics that I discussed in the last article. As you’ll probably recall, I explained how to declare and implement private methods within a basic PHP 5 class.

    Of course, all of the examples were pretty simplistic and certainly wouldn’t be used directly in real world conditions. However, they did show how easy it is to define private methods in PHP 5, and also how useful they can be in certain situations, particularly those cases where it’s necessary to severely protect the member of a given class from undesired access.

    Assuming that you’re familiar with working with private methods in PHP 5, it’s time to leap forward and tackle this final article of the series, which will be focused on covering some additional aspects concerning the use of this kind of class method. In addition, I’ll teach you how to utilize the “final” keyword, which is included with PHP 5, to prevent the methods of a specific class from being overridden by any subclass.

    Are you ready to begin reading this last episode? Let’s get started!

    More PHP Articles
    More By Alejandro Gervasio


       · This last article of the series covers some additional aspects concerning the use of...
     

       

    PHP ARTICLES

    - Validating Web Forms with the Code Igniter P...
    - Output Buffering
    - Paginating Database Records with the Code Ig...
    - HTTP Headers in Web Development
    - Project Management: Administration
    - Building a Database-Driven Application with ...
    - User Authentication for a Project Management...
    - Introduction to the CodeIgniter PHP Framework
    - Adding Users for a Project Management Applic...
    - Migrating Class Code for a MIME Email to PHP...
    - Login and Logout Authentication for a Projec...
    - Composing Messages in HTML for MIME Email wi...
    - Project Management: Authentication
    - A Better Way to Determine MIME Types for MIM...
    - Project Management Overview





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway