unread
Try to answer the question: what is the $obj instance of?
namespace foo;
$obj = $factory->loadClass('bar\class');
$factory is implemented cca this way:
namespace ?;
class Factory
{
function loadClass($class) {
return new $class;
}
}
With absolute FQN is the answer evident. With relative FQN it is very
esoteric.
With relative FQN developers will have to implement "save" loadClass()
this way:
function loadClass($class)
{
if (strpos($class, '\') !== FALSE
&& strncmp($class, '\', 1)) {
$class = '\' . $class;
}
return new $class;
}
OMG
David Grudl
unread
David Grudl wrote:
Try to answer the question: what is the $obj instance of?
namespace foo;
$obj = $factory->loadClass('bar\class');
bar\class
dynamic class names are always FQN.
Greg