调用多个类的最佳方法? [英] Best way of calling multiple classes?

查看:77
本文介绍了调用多个类的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设计一个包含很多类的小框架(每个类1个文件)和

想知道调用每个类的最佳方法吗?


显然我可以调用每个使用过的文件,但可以是10个或更多

包含语句。我想知道是否有更好的方法?有点

很烦人,你不能像Java那样构建软件包。


干杯


Phil

I''m designing a small framework with a lot of classes (1 file per class) and
want to know the best method of calling each class?

Obviously I could I call each file that is used but that could be 10 or more
include statements. I am wonering if there is a better way? It''s bit
annoying you can''t build packages like Java.

Cheers

Phil

推荐答案

Phil Latio写道:
Phil Latio wrote:

我正在设计一个小框架很多课程(每班1个文件)

并且想知道调用每个班级的最佳方法吗?


显然我可以把每个文件称为使用但可能是10或

更多包含语句。我想知道是否有更好的方法?它有点像

,你不能像Java一样构建软件包。
I''m designing a small framework with a lot of classes (1 file per class)
and want to know the best method of calling each class?

Obviously I could I call each file that is used but that could be 10 or
more include statements. I am wonering if there is a better way? It''s bit
annoying you can''t build packages like Java.



RTFM关于__autoload()。


-

------ ----------------------------
$ b $bIvánSánchezOrtega-ivansanchez-algarroba-escomposlinux-punto-org-

http://acm.asoc。 fi.upm.es/~mr/

用2.6.22-1-amd64内核,KDE 3.5.7和PHP骄傲地运行Debian Linux
5.2.3-1 + b1生成此签名。

正常运行时间:01:52:55最多7天,22:13,5位用户,平均负载:0.28,0.31,0.43

RTFM about __autoload().

--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

http://acm.asoc.fi.upm.es/~mr/
Proudly running Debian Linux with 2.6.22-1-amd64 kernel, KDE 3.5.7, and PHP
5.2.3-1+b1 generating this signature.
Uptime: 01:52:55 up 7 days, 22:13, 5 users, load average: 0.28, 0.31, 0.43


Phil Latio写道:
Phil Latio wrote:

我正在设计一个包含很多类的小框架(1个文件)每个班级)和

想知道调用每个班级的最佳方法吗?


显然我可以调用每个使用过的文件,但可能是10个或更多

包括声明。我想知道是否有更好的方法?有点

很烦人,你不能像Java那样构建软件包。


干杯


Phil

I''m designing a small framework with a lot of classes (1 file per class) and
want to know the best method of calling each class?

Obviously I could I call each file that is used but that could be 10 or more
include statements. I am wonering if there is a better way? It''s bit
annoying you can''t build packages like Java.

Cheers

Phil



我刚刚加入了包含声明。


实际上,我不使用包含 - 我使用require_once。如果一个班级

依赖于另一个班级(通常在我的情况下),则require_once会在需要的文件中输入




那样主文件只需要担心它需要什么,因为每个

文件都会处理它自己的包含。


__autoload很好 - 但是它需要额外处理超过

require_once,几乎所有内容都必须位于同一个

目录中。


-

==================

删除x来自我的电子邮件地址

Jerry Stuckle

JDS计算机培训公司
js ******* @ attglobal.net

==================

I just put in the include statements.

Actually, I don''t use include - I use require_once. And if a class
depends on another class (often in my case), the require_once goes in
the requiring file.

That way the main file only needs to worry about what it needs, as each
file takes care of its own includes.

__autoload is good - but it requires extra processing over and above a
require_once, and pretty much everything has to reside in the same
directory.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


RTFM关于__autoload()。


谢谢,我当然会。


干杯


Phil
RTFM about __autoload().

Thank you, I most certainly will.

Cheers

Phil


这篇关于调用多个类的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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