4. Which object-oriented pattern would you use to implement a class that must be instantiated only once for the entire lifespan of a script?


Вариант ответа 1 - A) Model-view-controller

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

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

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

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


Комментарий: The Singleton Pattern is handy whenever only one instance of a particular class can exist at any given time (and, yes, in case you’re wondering, you should expect the exam to test you on the basics of patterns, too).

Комментарии

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