parent = $parent; $this->setPrivate(false); } public function getParent() { return $this->parent; }什么是依赖注入?IOC:英文全称:Inversion of Control,中文名称:控制反转,它还有个名字叫依赖注入(Dependency Injection,简称DI)。当一个类的实例需要另一个类的实例协助时,在传统的程
reflector = $reflector ?: new StandardReflector; $this->cache = $cache ?: new ReflectionCacheArray; } public function getClass($class) { $cacheKey = self::CACHE_KEY_CLASSES . strtolower($class); if (!$reflectio
先看一个例子:
b=new B();
$this->c=new C();
$this->b->Method();
$this->c->Method();
//TODO
}
}
class B
{
public function B()
{
//TODO
}
public function Method()
{
//TODO
先看一个例子:
b=new B();
$this->c=new C();
$this->b->Method();
$this->c->Method();
//TODO
}
}
class B
{
public function B()
{
//TODO
}
public function Method()
{
//TODO