Download

Extending a static function?

Using something like the following in a child class, trying to extend the functionality of it’s parent results in an error:

static function MyStaticFunction()
{
    super.static.MyStaticFunction();
}

Error: “Error, Unknown Function ‘static’ in 'Class”.

So is it not possible to extend a static function? Obviously calling the parents function explicitly (using it’s full class name) would mean it would not have access to the child’s default params.

All I remember from this nasty concept, it is that you can call the function without spawning the class.

Why is this a nasty concept? Do you mean static functions in general, or extending a static function?

I don’t see either as nasty. Static functions are essential for utility classes (where you don’t want to keep instancing full objects), and many more cases.

I can only think of it being nasty if you don’t understand it :man_shrugging:

I’ve never had to override a static function so this is me just guessing. I assume you already tried super.MyStaticFunction() right?
in the alternative you provide, why would it not have access to the chlld’s default params? can’t you pass those params in the call as well?