keeB Posted December 1, 2006 Share Posted December 1, 2006 Hello everyone, it feels weird posting my own topic instead of answering others! :)I have a quick question about abstract classes. What is wrong with the following code?[code=php:0]<?phpabstract class a { public $a = 5; }class b extends a { public function b() { print a::$a; }}?>[/code]Your thoughts are appreciated Link to comment https://forums.phpfreaks.com/topic/29153-class-abstraction-fixed/ Share on other sites More sharing options...
keeB Posted December 1, 2006 Author Share Posted December 1, 2006 fixed it myself.... apparently $a needs to be declared static in class a :)fixed code:[code=php:0]abstract class a { public static $a = 5; }class b extends a { public function b() { print a::$a; }}[/code] Link to comment https://forums.phpfreaks.com/topic/29153-class-abstraction-fixed/#findComment-133652 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.