0
У меня есть этот код, который я хочу сделать метод абстракции в родителя и ребенка будет определить свойствоPHP ACCESSING ребенка от родителей
class SuperClass{
static protected $message = "This is the parent";
public static function showMessage(){
echo self::$message."<br/>";
}
}
class SubClass1 extends SuperClass {
static protected $message = "This is the first child";
}
class SubClass2 extends SuperClass {
static protected $message = "This is the second child";
}
SuperClass::showMessage();
SubClass1::showMessage();
SubClass2::showMessage();
я бы ожидал увидеть
This is the parent
This is the first child
This is the second child
Но что я получил
This is the parent
This is the parent
This is the parent
Aha! это оно! спасибо :) –