I require type checking

Eg. A nasty example

class A {

            function A() {}

            function getObj():C {

                        var bObj:B = new B();

                        var _aObj:Object = {};

                        _aObj['b'] = bObj

                        return _aObj['b'];

            }

}

class B extends C {

            function B(){}

            function doB():String{

                        return 'b.done';

            }

}

class C{}

//test

var aObj:A = new A();

trace(aObj.getObj().doB()); //compiler error of course

 

I don’t want have to define doB on the C class, but still have compile time type checking if I call a method that does not exist on B or C

 

 

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ian Thomas
Sent: Wednesday, 24 May 2006 2:48 AM
To: [EMAIL PROTECTED]; Open Source Flash Mailing List
Subject: Re: [osflash] Dynamic return types

 

Won't a return type of Object cover whatever you need?

Ian

On 5/23/06, Bjorn Schultheiss <[EMAIL PROTECTED] > wrote:

Is it possible to dynamically set a method's return type in as2, as3 or haxe?

 

 

_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org

Reply via email to