PHP
  Home arrow PHP arrow Defining Public and Protected Methods ...
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 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Mobile Linux 
App Generation ROI 
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

Defining Public and Protected Methods with Member Visibility in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-06-11

    Table of Contents:
  • Defining Public and Protected Methods with Member Visibility in PHP 5
  • Calling methods of a class globally
  • Declaring and implementing protected methods within PHP 5 classes
  • Calling protected methods from a subclass

  • 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


    Defining Public and Protected Methods with Member Visibility in PHP 5


    (Page 1 of 4 )

    In the previous articles of this series, I explained how to work with public and protected class properties. So now it’s time to demonstrate how to specify these same levels of visibility in the respective methods of a class. Sounds pretty interesting, right?

    As an enthusiastic PHP programmer, you should be aware of how useful it can be to protect the data members of your classes from unwanted access. Fortunately, when working specifically with PHP 5, setting different levels of restriction for the methods and properties of a specific class is a process reduced to specifying the appropriate keywords (i.e. whether they're going to be public, protected, or private).

    However, if you're just starting to explore the huge terrain of object-based programming in PHP 5, then you're probably looking for a comprehensive guide on how to use the member visibility feature incorporated into this language's object model. In that case, there's good news for you. In this group of articles you'll learn all that you need to begin working with public, protected, and private class members in PHP 5.

    Now that you know what will be treated in this fourth chapter of the series, it's time to learn how to declare and implement public and protected methods with PHP 5 classes.

    Of course, as always I'm going to address this useful topic by using a hands-on approach, which means that there's a bunch of code samples ahead, waiting patiently for you. So, don't waste more time and start reading this article now!

    More PHP Articles
    More By Alejandro Gervasio


       · This fourth part of the series explains how to declare and implement public and...
     

       

    PHP ARTICLES

    - Working With Different Namespaces in PHP 5
    - User Management Explained: Overview
    - Using Namespaces in PHP 5
    - Database Security: Guarding Against SQL Inje...
    - Building a Modular Exception Class in PHP 5
    - Database and Password Security for Web Appli...
    - Handling MySQL Data Set Failures in PHP 5
    - Building Site Registration for Web Applicati...
    - Intercepting Customized Exceptions in PHP 5
    - Securing Your Web Application Against Attacks
    - Sub Classing Exceptions in PHP 5
    - Authentication for Web Application Security
    - Building a Content Management System with Co...
    - Filters and Login Systems for Web Applicatio...
    - Working with the Email Class in Code Igniter





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT