3. How can you write a class so that some of its properties cannot be accessed from outside its methods?


Вариант ответа 1 - A) By declaring the class as private

Вариант ответа 2 - B) By declaring the methods as private

Вариант ответа 3 - C) It cannot be done

Вариант ответа 4 - D) By writing a property overloading method


Комментарий: Answer C is correct. In PHP, it is not possible to limit access to class members or properties. This can, however, be done in PHP 5, for example by declaring a property as private.

Комментарии

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