You are here: Re: Inheriting Variables « All PHP « IT news, forums, messages
Re: Inheriting Variables

Posted by Gale on 10/10/38 11:23

Hale wrote:
> Hi,
>
> I have a dilemma I'm hoping you can help w/.
>
> I have a class where I'm passing a variable into the ctor of the base class
> and I want to use that value in a derived class in a function like below.
> The problem is, in the function something(), $this->param is NULL. How can
> I get this working correctly?
>
> Thanks.
>
> -----------------------------------
>
> class class1
> {
> public $param;
> function __construct($variable)
> {
> $this->param = $variable;
> }
> }
>
> class class2 extends class1
> {
> funcion something()
> {
> print $this->param;
> }
> }
>
>
try with scope ::

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация