0

In PHP, wa can't overload without break PHP Strict standards:

class A { 
  public function say($a, $b){
    echo "$a $b";
  } 
}

$a = new A();
$a->say('foo', 'baz'); // foo bar

class B extends A { 
  public function say($a){
    parent::z($a, 'bar');
  } 
}

$b = new B();
$b->say('foo'); // foo baz

What could be a good way to do this complying with PHP Strict standards and with a good readability/maintainability ? If it's possible to do it without ugly code ...

bux
  • 7,087
  • 11
  • 45
  • 86

0 Answers0