I am preparing for the ZEND Certified Engineer-Exam. Using the TestPassport-Engine "Virtual Exam", I came across this question:
Consider the following code. Which keyword should be used in line marked in bold to make this code work as intended?
abstract class Base {
protected function __construct() {}
public function create(){
// this line
return new self();
}
abstract function action();
}
class Item extends Base {
public function action () { echo __CLASS__; }
}
$item = Item::create();
$item->action();
And the correct answer is static
. So, how should that look like in the end?