Re: [PHP-DEV] "::" meaning and documentation From: Stefan Livieratos (stefan <email protected>)
Date: 06/26/00

-----Ursprüngliche Nachricht-----
Von: Chuck Hagenbuch <chagenbu <email protected>>
An: Stefan Livieratos <stefan <email protected>>
Cc: Ulf Wendel <ulf <email protected>>; <php-dev <email protected>>
Gesendet: Montag, 26. Juni 2000 18:25
Betreff: Re: [PHP-DEV] "::" meaning and documentation

> Quoting Stefan Livieratos <stefan <email protected>>:
>
> > No side effect. Static method calls were introduced so that in a
subclass
> > you can call methods of the parent class.
>
> If $this is empty in methods called with the :: notation, then how can you
> usefully call a method of the parent class? Or is $this magically set to
the
> right thing in those cases?
>

$this is not empty when calling a static method from within a class:

--cut--
class foo {
    var $a = "A";
    function doit() {
        print $this->a;
    }
}

class bar extends foo {

    function doit() {
        foo::doit();
        print "OK";
    }
}

$b = new bar;
$b->doit();
--cut--

prints AOK.

Regards,
Stefan

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>