Mailinglisten-Archive |
On Friday 02 April 2004 08:48, Sebastian Mendel wrote:
> patrick müller (aka elias) schrieb:
> > Mhh, ein statischer Aufruf kann jedenfalls nicht auf
> > Objekteigenschaften/-methoden zurückgreifen. Und wie du sagst wird
> > parent:: erst im Objektkontext benutzt.
>
> mhm? na auf Methoden schon? oder hab ich jetzt was überlesen?
> .. und auf Eigenschaften ab PHP5
>
php5
klassenbasierte Konstanten, statische Methoden/Eigenschaften
<?php
class konstant
{
const konstante = 53;
static $statisch = "static property";
}
class B extends konstant
{
function __construct() {
echo parent::konstante ."\n";
echo self::konstante ."\n";
}
static function statisch($a, $b) {
$mul = $a * $b;
return $mul;
}
}
echo konstant::konstante ."\n";
echo konstant::$statisch ."\n";
echo B::konstante ."\n";
echo B::statisch(5, 10) ."\n";
$t = new B;
?>
Gruesse
Friedhelm
php::bar PHP Wiki - Listenarchive