nerdexam
Zend

200-550 · Question #12

When would you use classes and when would you use namespaces?

The correct answer is A. Use classes to encapsulate code and represent objects, and namespaces to avoid symbol name. See the full explanation below for the reasoning.

Question

When would you use classes and when would you use namespaces?

Options

  • AUse classes to encapsulate code and represent objects, and namespaces to avoid symbol name
  • BUse classes for performance-sensitive code, and namespaces when readability matters more
  • CUse namespaces for performance-sensitive code, and classes when readability matters more
  • DAlways use them; namespaces are always superior to classes

How the community answered

(25 responses)
  • A
    76% (19)
  • B
    8% (2)
  • C
    12% (3)
  • D
    4% (1)

Community Discussion

No community discussion yet for this question.

Full 200-550 Practice