erweitern statische Methoden in php

class Foo {
  public static function foobar() {
    self::whereami();
  }

  protected static function whereami() {
    echo 'foo';
  }
}

class Bar extends Foo {
  protected static function whereami() {
    echo 'bar';
  } 
}

Foo::foobar();
Bar::foobar();

erwartete Ergebnis foobar tatsächliche Ergebnis foofoo

noch schlimmer zu machen, der server hat nur php 5.2

Schreibe einen Kommentar