php - How can i enforce an extending class to have a static method? -


i want class b implement method that's been defined in class a. when following error.

strict standards: static function a::test() should not abstract in c:\xampp\htdocs\test1.php on line 4

here php code:

<?php error_reporting( e_strict );  abstract class a{     public abstract static function test(); }  class b extends {     public  static function test(){         echo 'testing';     }; }  echo b::test(); 

static methods not part of object, shouldn't extended.

make method concrete.

i struggled same problem once started building unit tests (i religiously avoid static methods now, that's whole side conversation). check out question answering question berr can: why php 5.2+ disallow abstract static class methods?


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -