0

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?

2
  • What does this have to do with a singleton? Commented Aug 10, 2009 at 9:26
  • Nothing other than that that's the angle OP is coming at it from. Commented Aug 10, 2009 at 13:49

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

You mean the line "public function DoSomething() {parent::DoSomething();}" is redefining the DoSomething() function in the BaseSingleton class?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.