Is there a way to have PHP subclasses inherit properties (both static and instance)?

前端 未结 2 2049
予麋鹿
予麋鹿 2021-01-19 08:26

If I declare a base class as follows:

abstract class Parent {

  protected static $message = \"UNTOUCHED\";

     public static function yeah() {
         st         


        
2条回答
  •  半阙折子戏
    2021-01-19 08:46

    The answer is "with a workaround".

    You have to create a static constructor and have it called to copy the property.

提交回复
热议问题