I am trying to extend a class and override one of its methods. lets call that class A. My class, class B, is overiding a protected method. Class C extends class A and Class D extends class C. Inside of Class D, the method I am trying to overwrite is also extended here and that calls parent::mymethodimoverriding. That method does not exist in class C so it goes to it in class A. That is the method I am overiding in class B and obviously you can't extend A with B and have those changes show up in D since it does not fall in line with the class hierarchy. I might be wrong, so correct me please.
so if my class b is called and ran then class D gets called it runs the method in A and overwrites what I had set. I am thinking there must be a way to get this to work, I am just missing something.
Here is an example, as you can see in class A there is a call to setTitle and it is set to "Example" In my class I set it to "NewExample". My class is getting called before class D so when class D is called it goes back to the parent and sets the title back to "Example". What I would like to happen is class B runs and sets it to do what I need it to then class D run and instead of it hitting the class I am extending for it to hit my class instead. the thing is I don't think I can make class D extend my class. so now it is hitting the class I am extending
class A{
  protected function _thefunction(){
    setTitle("Example");
  }
}
class B extends A{
  protected function _thefunction(){
    My new code here
    setTitle("NewExample");
  }
}
class C extends A{
  nothing that matters in here for what I am doing
}
class D extends C{
  protected function _thefunction(){
    parent::_thefunction();
    additional code here
  }
}
I tried doing
class D extends C{
  protected function _thefunction(){
    B::_thefunction();
    additional code here
  }
}
and I got errors about it not being a static method