Re: Re: Rusu Ionut, PHP Question

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

 



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@xxxxxxxxx>:
> 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!!!
>

-- 
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