Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

hinom

Challenge for ZEND PHP5 Certification - 007

Exercise 7  

5 votos

  1. 1. You need to keep an eye on the existing number of objects of a given class without introducing a on-class member variable. Which of the following makes this happen?

    • A. Add member variable that gets incremented in the default constructor and decremented in the destructor.
      1
    • B. Add local variable that gets incremented in the each constructor and decremented in the destructor.
      0
    • C. Add static member variable that gets incremented in the each constructor and decremented in the destructor.
      4
    • D. This cannot be accomplished since the creation of objects is being done dynamically via "new".
      0


Recommended Posts

Exercise 7

 

 

You need to keep an eye on the existing number of objects of a given class without introducing a on-class member variable. Which of the following makes this happen?

 

a. Add member variable that gets incremented in the default constructor and decremented in the destructor.

b. Add local variable that gets incremented in the each constructor and decremented in the destructor.

c. Add static member variable that gets incremented in the each constructor and decremented in the destructor.

d. This cannot be accomplished since the creation of objects is being done dynamically via "new".

Answer: C

 

Explanation

 

http://php.net/oop5

Compartilhar este post


Link para o post
Compartilhar em outros sites

Boa contribuição

 

:joia:

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.