Design Patterns - function overriding in moduls

Hi everyone,

I’ve just met the following situation:

I wanted to override an init() in my custom modul, the original init looks like:

public function init() {
.
.
parent::init();
}

now, for the first time i didn’t saw this parent::init() and if the original weren’t faulty
i’ve never got the knowledge of this.
At the second glance i realized, that i shouldn’t call parent::init() but the grandpa’s init()
(actually the great-great-grandfather’s) to be sure that everything works well.
That wasn’t that easy as its sounds like, and that’s why i would suggest for consideration
to extend the base classes with [<clasname>]initparent() { parent::init; }; or something in
this way.

thank you, and i’ll be glad for any responses.


class aList extends oxUBase
{
..
    public function render()
    {
..
        parent::render();
..
    }
..
}

module:


class my_module extends my_module_parent
{
    public function render()
    {
..
        oxUBase::render();
..
    }
}

it will NOT be static call ! so no warnings or debug notices.
only minus is that it will always call oxUbase::render, whatever modules are installed before.

hm! thank you, this does the trick very well, it’s much easier than my code, didn’t know this.