I have a class that has a complex static factory method, lets call it ClassA. I have extended ClassA into ClassB and I want ClassB's factory method to do everything that ClassA's factory method does, except return a ClassB.
class ClassA{
static public function Factory($construct_args, $contents){
$new = new ClassA($construct_args);
//Does lots of stuff with $contents
}
}
class ClassB extends ClassA{
//specialty methods and properties
}
echo get_class(ClassB::Factory($construct_args, $contents);
This should echo ClassB
Is there a way I can use ClassA's Factory Method without copy-pasting it to ClassB? I am using PHP5, but not 5.3.0.