Where is the problem?
you can create a function:
public function send(itemToSend:*):bool
{
if(itemToSend is String)
{
....
}
else if(itemToSend is Array)
{
....
}
}
Am 16.01.2012 um 16:02 schrieb Nicholas Kwiatkowski:
> While I'm no prueist OOP chest-beater, I would love to see method
> overloading. I deal a lot with back-end communication systems, and one
> thing I hate doing over, and over, and over again are methods like :
>
> public function sendAsString(stringToSend:String):bool
> public function sendAsBool(boolToSend:Boolean):bool
> public function sendAsArray(arrayToSend:Array):bool
> public function sendAsInt(intToSend:int):bool
> ...
> ...
>
>
> All of the code within those functions is EXACTALLY the same. This also
> means that the API is much easier, and allows the constitution between the
> component and the base-application to be much easier to implement and
> easier to understand. It also helps with a lot of our "convert it to a
> generic and convert it back later" that we have to deal with over and over
> again in the SDK.
>
> We should be able to do the following :
>
> public function send(itemToSend:String):bool
> public function send(itemToSend:Boolean):bool
> public function send(itemToSend:Array):bool
> public function send(itemToSend:int):bool
> ....
> ...
>
> which would make the call as simple as : myComponent.send(anything);
>
> -Nick
>
> On Mon, Jan 16, 2012 at 9:53 AM, Martin Heidegger
> <[email protected]>wrote:
>
>> Overloading is the a way to implement two interface with conflicting
>> arguments for the same method:
>>
>> interface A {
>> function test(a: String): void;
>> }
>>
>> interface B {
>> function test(b:int):void;
>> }
>>
>> class C implements A,B {
>> function test(a:String):void {};
>> function test(b:int):void {};
>> }
>>
>> Without it relying on interfaces might be a stressful thing.
>>
>> yours
>> Martin.
>>
>>