I'm super-sorry for the slightly offtopic question; this is a super-thriving community of PHP5 OOP pros, so I figured I'd try my luck here.
I consider myself very comfortable with OOP; I've done it in PHP5 for a while, but this issue just knocks me dead.
I don't know how to use overloading with static class members. PHP5 just seems to ignore it.
class Message {
public static function test() {
return self::getMyConstant();
}
public static function getMyConstant() {
return "0";
}
}
class IncomingMessage extends Message {
public static function getMyConstant() {return "a";}
}
class OutgoingMessage extends Message {
public static function getMyConstant() {return "b";}
}
I'd like to call OutgoingMessage::getMessageType(), and receive a valid value (“b”)... Instead, I receive a “0” - wrong method gets called.
Any ideas? Is there another way of doing this statically? I really don't want to move this method/property into a the object properties since I need to call it form static context.
Thanks a bunch, and I again apologize for an offtopic.
P.S. If you want to know what I'm doing - I'm working on a daemon-based infrastructure to send out email messages asynchronously. QEmailServer is great, but it sometimes takes up to 10 seconds to send a message (using GMail), so I don't want to put that logic onto the UI thread :-)