Home arrow PHP arrow Defining Public and Protected Methods with Member Visibility in PHP 5

Defining Public and Protected Methods with Member Visibility in PHP 5

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?

TABLE OF CONTENTS:
  1. Defining Public and Protected Methods with Member Visibility in PHP 5
  2. Calling methods of a class globally
  3. Declaring and implementing protected methods within PHP 5 classes
  4. Calling protected methods from a subclass
By: Alejandro Gervasio
Rating: starstarstarstarstar / 2
June 11, 2008

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

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
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: