Re: Q on Class and EXTEND

From: Date: Wed, 03 Sep 2003 17:42:03 +0000
Subject: Re: Q on Class and EXTEND
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-161575@lists.php.net to get a copy of this message
On Wed, 3 Sep 2003 10:05:46 -0700 "Chris Sherwood" <csherwood@nortialearning.com> wrote: > > <-- snip --> > > > I dont know much about classes, but dont you want > > > > > > $a = new THECHILD('walter'); //so you can access $a->abc > > > > > > instead of > > > > > > $a = new THEPARENT ('walter'); > > > > No, 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. > > > > Walter > <-- snip --> > > walter you want to do a declaration in the class that you want to > use the base class in ie > > > when you declare your child class > > class Web_child extends WEB_parent > { > -- your new and extended code here > } > and then ... to access the class methods and variables of the parent, you do it through the child. class THEPARENT var $originalthis; function THEPARENT(){ } } class THECHILD extends THEPARENT var $this; function THECHILD($that) { $this->this = $that; } } // outside the class $clss = new THECHILD($thatvar); $clss->originalthis = 'how about that'; -- Raquel ============================================================ Let no man imagine that he has no influence. Whoever he may be, and wherever he may be placed, the man who thinks becomes a light and a power. --Henry George -- Raquel ============================================================ Let no man imagine that he has no influence. Whoever he may be, and wherever he may be placed, the man who thinks becomes a light and a power. --Henry George

« previous php.general (#161575) next »