Home arrow PHP arrow Abstract Classes in PHP: Working with PHP 5

Abstract Classes in PHP: Working with PHP 5

Here we are again. This is the tutorial you’ve been waiting for! Welcome to the last part of the series “Abstract classes in PHP.” If you’ve already read the previous articles, then you’ll know that this series introduces the basics of abstract classes in PHP 4/PHP 5, and illustrates their use and implementation in concrete situations.

TABLE OF CONTENTS:
  1. Abstract Classes in PHP: Working with PHP 5
  2. Working with a highly improved object model: defining abstract classes in PHP 5
  3. Calling class methods out of the object context: using the scope resolution operator
  4. Using abstract classes in PHP 5: setting up an example
By: Alejandro Gervasio
Rating: starstarstarstarstar / 50
February 08, 2006

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Introduction

Before I leap forward, it’s worth a brief look back to remind you of what you learned during the previous installment of this series, so it’ll be much easier to continue with the topics that will be discussed in this final tutorial. As you’ll recall, in the second part I demonstrated how to create a well-defined hierarchy of data processing PHP 4 classes, with the base class being abstract. This originally provided a set of undefined, highly generic methods for converting data to different formats.

In consonance with the concepts deployed before, I derived two specific subclasses from the base class. These classes were responsible for processing file data, along with MySQL result sets. To achieve these tasks, each child class provided a concrete implementation for each generic method declared within the corresponding parent class. This condition demonstrated how to use a PHP 4 abstract class as the starting point from which to derive as many subclasses as needed, in order to perform concrete operations within a given PHP application.

As you know, the whole idea of defining an abstract class is to allow you to define generic characteristics of a given object (including properties and methods), and then implement a concrete functionality by using the methods of the respective subclasses. So now it’s clear and fresh in your mind what abstract classes are and how to use them during the development cycle of a Web application.

That said, in this last part of the series, I’ll explain the key points of abstract classes in PHP 5, and additionally provide you with some hands-on examples. This should give you a clear idea of how to utilize them within the powerful Object Model implemented in the latest version of PHP.

Assuming that you’re interested in learning more about PHP 5 abstract classes, it’s time to move forward and find out how to use them. Let’s get going!



 
 
>>> More PHP Articles          >>> More By Alejandro Gervasio
 

blog comments powered by Disqus
   

PHP ARTICLES

- 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...
- PHP: Building Concrete Validators
- Sanitizing Input with PHP
- Executing Shell Commands with PHP
- Handling File Data with PHP
- File Security and Resources with PHP
- ArrayObject PHP Class Examples
- ArrayObject PHP Class: An Introduction
- Getting File System Data with PHP
- PHP Tools for Working with the File and Oper...
- Working with the File and Operating System w...
- PHP Proxy Patterns: Completing a Blog


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 6 - Follow our Sitemap

Dev Shed Tutorial Topics: