Re: working with class inheritance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, March 20, 2007 3:42 am, Jeff Taylor wrote:
> Hey all, got a slight problem, where for some reasons my variables
> dont seem
> to be getting stored in the child class:
>
> e.g
>
> class Parent
> {
>   $private type;

Either you meant private $type; or I'd be shocked if this even got as
far as executing your subclass...

Please paste real code instead of making us guess what you have.

>   public function __construct()
>   {
>   }
>
>    public function GetType()
>    {
>       return $this->type;
>   }
> }
>
> class Child implements Parent
> {
>     $public function __construct()
>
>
>       $this->type= 'Child';
>       }
> }
>
> $Child= new Child();
> echo $Child->getType;
>
> Can u see any reason why the type would return null?

One possible answer:
If you are running PHP4, the constructor never gets called because
that's not how it was done in PHP4.

There are, of course, an infinite number of other possible answers, if
this isn't the actual code you are using.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux