Referencing different static members in

From: Date: Mon, 14 Mar 2005 18:11:18 +0000
Subject: Referencing different static members in
Groups: php.general 
Request: Send a blank email to php-general+get-210678@lists.php.net to get a copy of this message
Hi, In the static function "toHtml_table_heading" I want to use a static array $fields, which is defined differently in each implementation. My first trial was to use self::$fields[] to access this array, but this only sees the member of DBTable, not the inherited from DBTable. My second trial was to pass the classnmae thru $classname and to access the correct $fields with $classname::$fields, but that doesn't seem to work. abstract class DBTable { static protected $fields = array(); static function toHtml_table_heading($classname) {
       $fields = $classname::$fields;  // <== syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM
      //...
} //... } class DBImplementation extends DBTable { public function intializeClass() {
     self::$fields[] = new Object(1);
     self::$fields[] = new Object(2);
} function __construct() {
     intializeClass()
} }

« previous php.general (#210678) next »