【发布时间】:2013-04-23 16:57:22
【问题描述】:
我正在学习 OOP,并且非常困惑于彼此使用类。
我总共有 3 节课
//CMS System class
class cont_output extends cont_stacks
{
//all methods to render the output
}
//CMS System class
class process
{
//all process with system and db
}
// My own class to extends the system like plugin
class template_functions
{
//here I am using all template functions
//where some of used db query
}
现在我想在两个系统类中使用我自己的类 template_functions。但是很迷茫怎么用。请帮助我理解这一点。
编辑: 对不起,我忘了在不同的 PHP 文件中提到我自己的类。
【问题讨论】:
-
我很困惑你的困惑是什么......
-
听起来你想要多重继承,以便 cont_output 扩展 cont_stacks 和 template_functions?因为否则,没有理由 #1 类不能调用静态方法,或者在自身内部实例化类 #2 的副本。
-
@MarcB 这有点像,但取决于我如何在两个类中使用我自己的类。