<?php
class Base {
protected static $c = 'base';
public static function getC() {
return self::$c;
}
}
class Derived extends Base {
protected static $c = 'derived';
}
echo Base::getC(); // output "base"
echo Derived::getC(); // output "base", but I need "derived" here!
?>
Quindi qual è la soluzione migliore?Override di membri statici in classi derivate in PHP
sostituire self :: $ c con statico :: $ c – Artefacto
@Artefacto Grazie, che funziona bene! –