note 75274 deleted from language.oop5 by colder

From: Date: Sun, 19 Aug 2007 23:37:32 +0000
Subject: note 75274 deleted from language.oop5 by colder
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-129602@lists.php.net to get a copy of this message
Note Submitter: Mino ---- I've tested some abstract classes with static variable. I hope, you can use it too. ;) abstract class test { public static $test = 1; public function get() { return self::$test; } } class test2 extends test { public static $test = 2; public function get() { return self::$test; } public function getParent() { return parent::$test; } public function getParent2() { return parent::get(); } } $test = new test2(); echo $test->get()."<br>"; echo test2::get()."<br>"; echo test::get()."<br>"; echo $test->getParent()."<br>"; echo $test->getParent2()."<br>"; // output // 2 // 2 // 1 // 1 // 1

« previous php.notes (#129602) next »