Hi Pedro, Thanks for the guide.
What if I don't have any control over my superclass, like if I were importing this from a swc library or something? For now I kinda give up the idea of "overriding" and ended up just use a slightly different method name ("dataProviderr") for my "overriden" class: public function set dataProviderr(v:Object):void Thanks again! --- In flexcoders@yahoogroups.com, Pedro Sena <sena.pe...@...> wrote: > > If you want the same method name in a subclass, we are talking about > override, not overload. > > Flex 'deals with overload' making the arguments optionals, example: > > public function test(obj:Object = null):void > > then you can invoke it using test() or test(object). > > Appears that you are trying to override parent's function but changing it > signature, that is not possible. > > If you want to have in the same class, in the same function, receive two > different parameters, you can: > > public function set dataProviderr(v:Object = null, a:Array = null):void > > Then you can put the argument that you want, leaving the another one as null > > or you can > > public function set dataProviderr(v:*):void > > This way you can pass anything you like. > > Both solutions are ugly, IMHO, but is the way flex works. > > HTH, > > PS > > On Thu, May 28, 2009 at 6:58 PM, gwangdesign <gwangdes...@...> wrote: > > > > > > > Hi, > > > > I am trying to "overload" a method (same name and different signatures)in a > > subclass. In the inherited class, the method looks like this: > > > > public function set dataProvider(value:Array):void > > > > In my subclass I want the method to look like this: > > > > public function set dataProviderr(v:Object):void > > > > So that I can handle different types. > > > > I understand AS3 doesn't support overloading. What would be the smart > > way(s) to handle this? > > > > Thanks. > > > > geng > > > > > > > > > > -- > /** > * Pedro Sena > * Systems Architect > * Sun Certified Java Programmer > * Sun Certified Web Component Developer > */ >