Re: Re: Rusu Ionut, PHP Question
| From: | Jan G.B. | Date: | Thu, 26 Mar 2009 16:34:18 +0000 |
| Subject: | Re: Re: Rusu Ionut, PHP Question | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-290706@lists.php.net to get a copy of this message | ||
Erm, aren't "extends" what you're looking for?
To accomplish the auto-loading of needed subclasses?
example:
<?php
class FOO {
static $x = 'Hello World';
}
class BAR extends FOO {
public $greeting = false;
public function __construct() {
$this->greeting = parent::$x;
}
}
$test = new BAR();
echo $test->greeting;
?>
Prints out "Hello World".
Sure - the if you put class FOO in a separate file, than you need to
require_once(it) (as often as you need to) - it'll be there.
bye
2009/3/26 Ionut Rusu <johnrusu@gmail.com>:
> sry to boder you again but i didnt quite understood youre answer, i got the
> part where to add the include files on the top of the file or with
> require_once statment, but i still dont understant how is it posiible to add
> classes to the constructor with the include statment and not trigger a
> nested class error......
>
> is it corect to add include files( php classes ) to the constructor, and if
> so how does php do it....
> thank you!!!
>