Just a quick question. I understand that Singleton patterns can be extended and that inheritance is applied. I was just wondering if I called a base class and then a extended class is there additional overhead than if I just called the extended class by itself?
A:
If what you're talking about is something like
class BaseSingleton {
public function DoSomething() {
}
}
class ExtendedSingleton extends BaseSingleton {
public function DoSomething() {
parent::DoSomething();
}
}
then yes, there is overhead in the call being forwarded from the child class's DoSomething()
to the parent class's. If ExtendedSingleton
does not redefine DoSomething()
, though, there is no additional overhead.
chaos
2009-08-10 06:47:45
You mean the line "public function DoSomething() {parent::DoSomething();}" is redefining the DoSomething() function in the BaseSingleton class?
EddyR
2009-08-10 08:10:28
Right.
chaos
2009-08-10 08:40:06