Re: Q on Class and EXTEND
| From: | jsWalter | Date: | Wed, 03 Sep 2003 17:17:04 +0000 |
| Subject: | Re: Q on Class and EXTEND | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-161571@lists.php.net to get a copy of this message | ||
"John W. Holmes" <holmes072000@charter.net> wrote in message
news:3F561CF1.3000100@charter.net...
> jsWalter wrote:
> > I'm wanting to EXTEND the orginal class.
> >
> > meaning, my THECHILD class efines new methods/properties, and I want it
used
> > as if it was part of the orginal THEPARENT Class.
> >
> > Me just being picky.
>
> It doesn't work that way, exactly. The child class can define new
> methods and properties, but you must make an instance of the child
> class, which will include the methods/properties from the parent, and
> the new ones you have written.
>
> If I'm understanding you correctly, you could rename you parent class to
> child, name the child class the same as your parent and have the "old
> class" extend the "new class" you've written. You code should then work
> the same, but have the new methods/properties available.
What I am trying to do is EXTEND the PEAR::Auth Class with new properties
and methods.
But I still want to use the original instantiation call...
$myAuth =& Auth();
So, I don't think I can rename the orginal Class in this case.
I'm just being particular.
Or do I have to create my new EXTENDED Class and then add code to PEAR::Auth
to make it work as if it is always just Auth? (I was told I could not do
that)
Thanks
Walter