跟踪PHP4中有多少对象 [英] keep track how many object in PHP4

查看:67
本文介绍了跟踪PHP4中有多少对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助。


我需要跟踪一个给定类的对象数量而不引入非类成员变量

。以下哪一项允许我这样做?
这个?


1)添加在默认构造函数中递增的成员变量和

在析构函数中递减。

2)添加在每个构造函数中递增的局部变量,并在析构函数中递减


3)添加在每个构造函数中递增的静态成员变量



在析构函数中递减。

4)这是无法实现的正在通过new动态创建对象




谢谢!

Please help.

I need to keep track of how many object of a given class without introducing
a non-class member variable. Which one of the following will allow me to do
this?

1) Add member variable that gets incremented in the default constructor and
decremented in the destructor.
2) Add local variable that gets incremented in the each constructor and
decremented in the destructor.
3) Add static member variable that gets incremented in the each constructor
and
decremented in the destructor.
4) This cannot be accomplished since the creation of objects is being done
dynamically via "new".

Thank you!

推荐答案

9月4日17:22,Andrew G. Koptyaev < kopty ... @ gmail.comwrote:
On 4 Sep, 17:22, "Andrew G. Koptyaev" <kopty...@gmail.comwrote:

请帮助。


我需要跟踪多少给定类的对象而不引入

a非类成员变量。以下哪一项允许我这样做?
这个?


1)添加在默认构造函数中递增的成员变量和

在析构函数中递减。

2)添加在每个构造函数中递增的局部变量,并在析构函数中递减


3)添加在每个构造函数中递增的静态成员变量



在析构函数中递减。

4)这是无法实现的正在通过new动态创建对象




谢谢!
Please help.

I need to keep track of how many object of a given class without introducing
a non-class member variable. Which one of the following will allow me to do
this?

1) Add member variable that gets incremented in the default constructor and
decremented in the destructor.
2) Add local variable that gets incremented in the each constructor and
decremented in the destructor.
3) Add static member variable that gets incremented in the each constructor
and
decremented in the destructor.
4) This cannot be accomplished since the creation of objects is being done
dynamically via "new".

Thank you!



感谢您在这里发布作业/面试测验。


正确的答案是以上都没有:使用一个工厂控制

创建/销毁。


C.

Thank you for posting your homework / interview quiz here.

The correct answer is none of the above: use a factory to control
creation / destruction.

C.


Andrew G. Koptyaev写道:
Andrew G. Koptyaev wrote:

我需要跟踪给定类的对象数量而不引入非类
引入非类成员变量。以下哪一项

允许我这样做?
I need to keep track of how many object of a given class without
introducing a non-class member variable. Which one of the following will
allow me to do this?



因为这显然是测试中的一个问题,正确答案

是学习。

-

----------------------------------

Iv ?? n S ?? nchez Ortega -ivan-algarroba-sanchezortega-punto-es-


que se les ha escapado de las manos。 Tienen miedo de sus propias网站。

- Gumersindo Lafuente,前导演de Elmundo.es。

Since this is obviously a question from a test, the correct answer
is "study".

--
----------------------------------
Iv??n S??nchez Ortega -ivan-algarroba-sanchezortega-punto-es-

"Los peri?3dicos tradicionales ya est??n muertos (...) quieren dominar algo
que se les ha escapado de las manos. Tienen miedo de sus propias webs."
-- Gumersindo Lafuente, ex-director de Elmundo.es.




Ivan Sanchez Ortega < ivansanchez-alg @ rroba-escomposlinux .-。punto .-。org>
$ b $bó???Yéì/ó???Yéìá×??×?ó??èóì??? àY??:news:g9 ********** @ hercules.cohp1 ...

"Ivan Sanchez Ortega" <ivansanchez-alg@rroba-escomposlinux.-.punto.-.org>
ó???Yéì/ó???Yéìá × ??×?ó??è óì???àY??: news:g9**********@hercules.cohp1...

Andrew G. Koptyaev写道:
Andrew G. Koptyaev wrote:

>我需要跟踪给定类的对象数量而不引入非类成员变量。以下哪一项将允许我这样做?
>I need to keep track of how many object of a given class without
introducing a non-class member variable. Which one of the following will
allow me to do this?



由于这显然是测试中的问题,正确的答案

是研究。


Since this is obviously a question from a test, the correct answer
is "study".



请指出我在 www上的相应文章.php.net

谢谢。

Please point me to corresponding article on www.php.net
Thank you.


这篇关于跟踪PHP4中有多少对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆