Damon
Damon

Reputation: 10809

Do I have to match arguments/parameters when making override function?

if I want to add something to the implementation of

public static function createPopUp(parent:DisplayObject,
                                   className:Class,
                                   modal:Boolean = false,
                                   childList:String = null,
                                   moduleFactory:IFlexModuleFactory = null):IFlexDisplayObject
{   
    return impl.createPopUp(parent, className, modal, childList, moduleFactory);
}

do I have to put all the arguments in my function declaration or does it pick them up implicitly?

Upvotes: 0

Views: 211

Answers (1)

Tomasz Stanczak
Tomasz Stanczak

Reputation: 13164

Yes - ActionScript doesn't support method overloading only overriding, in which case your method's signature must exactly match that of the overridden method.

But you are trying to override a static method which is not possible in ActionScript at all. If you want something like in the code snippet create your class not inheriting anything, put a static createPopUp method inside and let it call static createPopUp method from the class you want to decorate and call your class'es static method instead of the original one.

This impossibility to sensible inherit (or inherit at all) static methods is one of the reasons why one should try to restrain from using statics as much as possible - statics take away the power of inheritance from OO languages.

Upvotes: 2

Related Questions