nerdexam
Zend

200-710 · Question #28

You'd like to use the class MyDBConnection that's defined in the MyGreatFramework\MyGreatDatabaseAbstractionLayer namespace, but you want to minimize "as much as possible" the length of the class…

The correct answer is C. Alias MyGreatFramework\MyGreatDatabaseAbstractionLayer\MyDBConnection to a shorter name. See the full explanation below for the reasoning.

Namespaces

Question

You'd like to use the class MyDBConnection that's defined in the MyGreatFramework\MyGreatDatabaseAbstractionLayer namespace, but you want to minimize "as much as possible" the length of the class name you have to type. What would you do?

Options

  • AImport the MyGreatFramework namespace
  • BImport the MyGreatFramework\MyGreatDatabaseAbstractionLayer namespace
  • CAlias MyGreatFramework\MyGreatDatabaseAbstractionLayer\MyDBConnection to a shorter name
  • DAlias MyGreatFramework\MyGreatDatabaseAbstractionLayer to a shorter name

How the community answered

(55 responses)
  • A
    2% (1)
  • B
    13% (7)
  • C
    80% (44)
  • D
    5% (3)

Topics

#namespace aliasing#use statement#class import#fully qualified name

Community Discussion

No community discussion yet for this question.

Full 200-710 Practice