Constructor calling a factory pattern

I have a constructor calling a factory pattern from another class:




class href extends Atag
{
function _constructor($url, $item, $class)
{
   parent::factory($url, $item, $class);
}
}

$login_link = new href($url, $item, $class);

I want $login_link to be able to access all properties and methods from Atag. Is this the correct way?

The constructor function is __construct, not _constructor.

That said, what you propose will work, but does raise the question why you wouldn’t just call Atag::factory instead of new href

Also, do you have a class for each possible tag (it sure looks that way from the name Atag)? If so, why?

I have a pre-existing library im trying to adapt to the current calls I have and don’t want to go thru my code and change every call for each tag. I tried this, but it creates my tag without the parameters I specified, $url, $item, $class

Have you renamed _constructor to __construct? If not, then no, it won’t work …

O yea… I’ve done that… That was just a typo on my part.