[PHP5 RC1, Windows XP Pro]
Hi,

I have a few classes called Audio, System, etc. In order to not pollute the
namespace (if someone else has a System class, for example), I'd like to
separate my classes. One way of doing this would be to preprend each class
with some text, to make my classes something like "myProject_Audio",
"myProject_System", "myProject_Whatever". I would much rather be able to do
something like myProject::Audio, myProject::System. I would like to do this
by creating a class called myProject and having Audio and System be static
variables, referring to the classes Audio and System. The Audio and System
variables in class myProject would act as an alias to the Audio and System
classes.

I can access myProject::someVar fine when someVar is any variable, but I'm
unable to call:

$audio = new myProject::Audio;

Is there any way to do this? Should I create a static function Audio() in
class myProject and forward the variables to the Audio class? If I did that
I could call

$audio = new myProject::Audio(); or
$audio = new myProject::Audio("var1", "var2");

but then it would be hard to access variables in class Audio (because you
can't do myProject::Audio()::someVarInAudio because "Parse error: parse
error, unexpected T_PAAMAYIM_NEKUDOTAYIM")

Thanks,

Best Regards,
Bill Zeller

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to