Exam4Training

Which keyword should be used in the line marked with "KEYWORD" instead of "self" to make this code work as intended?

Consider the following code.

Which keyword should be used in the line marked with "KEYWORD" instead of "self" to make this code work as intended?

abstract class Base {

protected function _construct() {

}

public static function create() {

return new self();// KEYWORD

abstract function action();

class Item extends Base {

public function action() { echo _CLASS_;}

}

$item= ltem::create();

$item->action(); I I outputs "Item"

Answer: static

Exit mobile version