Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > aggregate static php classes

aggregate static php classes
Thread Tools
madmacgames
Grizzled Veteran
Join Date: Oct 2003
Status: Offline
Reply With Quote
May 27, 2005, 10:05 AM
 
is aggregation of static classes possible in php?

Say I have a static class myClass, and an unknown number of extension classes that I want to aggregate with it.

using it as an object, like $myClass = new myClass(); this is possible to do by then calling $myClass->function();

however, I'm wanting to aggregate a bunch of static classes into a single static class, so that I can call them by myClass::function();

is this possible in php version 4, does anyone know?
The only thing necessary for evil to flourish is for good men to do nothing
- Edmund Burke
     
madmacgames  (op)
Grizzled Veteran
Join Date: Oct 2003
Status: Offline
Reply With Quote
May 28, 2005, 09:19 AM
 
well it seems that you cannot do this in php4 (dunno about 5), so I just devised a simple solution whereby at the beginning of the script an instance of the class is initiated and all of the functions loaded for it are aggregated. Then throughout the script myClass::getFunction('functionName', $params); can be called which acts as a passthrough to the object. Maybe not the best solution but it works.
The only thing necessary for evil to flourish is for good men to do nothing
- Edmund Burke
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 04:50 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,