Oct 25, 2010
View 1 Replies
I'm sure there are a few of you scratching your head trying to figure out why I would ever want to do something like this, so I promise you this will make sense, just let me explain. I have a function that works just fine by it's self and I have some other classes that extend upon the base class to add some functions to it, these classes do the same task but in a different context or with additional information so they must do all of the steps of the parent class but they must also do some special sub set's in some cases. Is there a way I can still execute a's foo method and my sub classes foo method? I know I could fix this with some awful hacks like making the method a file, and then including that file in both the parent function and it's siblings where needed, or I could make a second method called bar() that would contain the instructions of foo() and have my sub classes overwrite foo() but call bar() when they need the functionality of foo(). I'm just wondering if I can do this without using some pretty interesting hacks, is there something I don't know about PHP that someone on here can teach me?