Home arrow PHP arrow Using Different Objects in the Same Script for Polymorphs in PHP

Using Different Objects in the Same Script for Polymorphs in PHP

Welcome to the final part of a seven part series on building polymorphs in PHP. In a friendly fashion, this series gets you started constructing polymorph classes specifically in PHP 5. It shows you how to accomplish this by using first interfaces, then parent classes, and finally a proper combination of both.

TABLE OF CONTENTS:
  1. Using Different Objects in the Same Script for Polymorphs in PHP
  2. Review: creating polymorph classes using interfaces and abstract classes
  3. Rendering HTML divs and paragraphs within the same script
  4. Passing a different argument to the parseContent()method of the polymorph classes
By: Alejandro Gervasio
Rating: starstarstarstarstar / 2
January 20, 2010

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

And now that you've been introduced to the main goal of this group of tutorials, it’s time to review the topics discussed in the last one. In that article I explained how to build a couple of polymorph classes; both of them inherited structure from a simple interface and functionality from an abstract class responsible for rendering generic HTML elements.

Also, it’s necessary to recall that each of the classes constructed a specific HTML element through a common method called “render().” They also parsed its contents via another method, named“parseContent(),” which was inherited from the pertinent interface.

However, analyzing the construction of these sample classes separately would not be very helpful for understanding their polymorph nature. To solve this issue, in this final chapter of the series I’m going to develop a couple of scripts where the classes will be put to work together.

Now, it’s time to tackle the last part of this hopefully educational exercise in building polymorph classes with PHP 5. Let’s get going!



 
 
>>> 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: