}
function b()
{
return 10;
}
}
?> - Ответ: C) Abstract methods"> PHP Test online - 6. What OOP construct unavailable in PHP does the following script approximate?<br><br><?php<br>class my_class<br>{<br>function my_funct ($my_param)<br>{<br>user_error ("Please define me", E_ERROR);<br>}<br>function b()<br>{<br>return 10;<br>}<br>}<br>?> - Верный ответ: C) Abstract methods

6. What OOP construct unavailable in PHP does the following script approximate?

<?php
class my_class
{
function my_funct ($my_param)
{
user_error ("Please define me", E_ERROR);
}
function b()
{
return 10;
}
}
?>


Вариант ответа 1 - A) Multiple inheritance

Вариант ответа 2 - B) Interfaces

Вариант ответа 3 - C) Abstract methods

Вариант ответа 4 - D) Private methods

Вариант ответа 5 - E) Function overloading


Комментарий: This tidbit of code approximates the behaviour usually provided by an abstract method. If this class is inherited by another class and the my_funct method is called without being overridden in the child class, the code will throw an error. Naturally, this is only an approximation of the way abstract methods work, but it’s the best that can be done using PHP limited object model.

Комментарии

Имя пользователяТекст комментарияВведите код