Главная /
PHP: ООП и классы /
Сценарий PHP содержит следующий код: <?php class cFoo { public $public = "открытый"; public $protected = "защищенный"; function GetContents(){return $this->protected." ".$this->public;} } $foo = new cFoo(); echo $foo->GetContents()." ".$foo-&g
Сценарий PHP содержит следующий код:
<?php
class cFoo
{
public $public = "открытый";
public $protected = "защищенный";
function GetContents(){return $this->protected." ".$this->public;}
}
$foo = new cFoo();
echo $foo->GetContents()." ".$foo->public;
?>
Укажите результат выполнения сценария:
вопрос
Правильный ответ:
защищенный открытый открытый
защищенный открытый
пустая строка
фатальная ошибка
Сложность вопроса
52
Сложность курса: PHP: ООП и классы
88
Оценить вопрос
Комментарии:
Аноним
Экзамен сдан на 4 с минусом. спс
10 фев 2016
Аноним
Это очень элементарный тест intuit.
15 янв 2016
Другие ответы на вопросы из темы программирование интуит.
- # Сценарий PHP содержит следующий код: <?php class cParent { protected function func() {echo "родитель";} } class cChild extends cParent { function func() {echo "потомок";} } $der = new cChild; $der->func(); ?> Укажите результат выполнения сценария:
- # Сценарий PHP содержит следующий код: <?php abstract class cBase { private $Data; function __construct($_Data){$this->Data = $_Data;} abstract function ShowData(); } class cDerivative1 extends cBase { function ShowData(){return $this->Data."&";} } class cDerivative2 extends cBase { function ShowData(){return $this->Data."U";} } $foo = new cDerivative1(6); $bar = new cDerivative2(3); echo $foo->ShowData().$bar->ShowData().$foo->ShowData().$foo->ShowData(); ?> Укажите результат выполнения сценария:
- # Из приведенных ниже высказываний укажите истинное:
- # Файл main.php подключает файлы script1.php и script2.php с помощью директивы include (сначала первый, потом второй). Файл script1.php подключает файл basescript.php (содержащий некоторый набор констант и часто используемых функций) с помощью директивы include, а script2.php - с помощью директивы include_once. Во время выполнения сценария main.php:
- # Сценарий PHP содержит следующий код: <?php class cFoo implements Iterator { private $Contents = array(); public $OperationCount = 0; public function __construct($_Contents) { $this->Contents = $_Contents; } public function rewind() { reset($this->Contents); } public function current() { return current($this->Contents); } public function key() { $this->OperationCount++; return key($this->Contents); } public function next() { $this->OperationCount++; return next($this->Contents); } public function valid() { return ($this->current() !== false); } } $foo = new cFoo(array( 1, 2,3,4)); $temp = 0; foreach ($foo as $bar) { $temp++; } echo $foo->OperationCount; ?> Укажите результат выполнения сценария: