Menu

More Overloading Issues w/ Inheritance

Help
dt
2005-02-03
2013-04-17
  • dt

    dt - 2005-02-03

    OK, I'm getting stumped while trying to use the overloading handlers.
    I'm a big fan of this solution to solve the lack of overloading in
    ActionScript, but it seems to be breaking my inheritance-- or-- I
    don't understand how to use it well (the more likely answer). Here
    goes:

    I have 6 classes and 1 interface. It looks like this ( general classes
    at the top [Z and A], with sub classes going down. I is the interface).

    A                Z

    ^                ^
    |                |

    B  ---- I ------ Y

    ^
    |

    C

    ^
    |

    D

    Some more info to try and fix my really bad ascii uml:

    A has a Y as a member field. A requires an A while constructing.
    B has a C as a member field. B requires a C while constructing.
    C requires a C while constructing.
    D requires a Y or D while constructing.

    Here's how this system is started:

    var y:Y = new Y();
    var d:D = new D(y);
    var c:C = new C(d);

    So, I'm tracing everything out. First thing called is the Z constructor.
    Makes sense. Then the Y constructor is called. Both of these are fine,
    because neither takes anything when constructing. However, the kicker is
    when a new D is created. First thing called is the A constructor. I
    assume that ActionScript starts at the top of inheritance chain and
    marches down. However, what's called is the null arguments handler.
    I know I'm passing it a fully functional Y. The overload handler does
    not give me an error. Is there no way to accomplish this? Must I declare
    every possibility of signature? Even if I explicitly set a handler for
    taking an Y as an argument, it still is calling the null arguments
    handler I've defined.

    How can I achieve this structure in ActionScript?

     
    • dt

      dt - 2005-02-03

      I lost some formatting. Let me clarify.

      A <- B <- C <- D

      Z <- Y

      D extends C extends B extends A

      Z extends Y

      Both B and Y implement I

       
    • dt

      dt - 2005-02-03

      I mean Y extends Z. Sorry.

       
    • eRom

      eRom - 2005-02-04

      Hi,

      Is it possible to send some .as file (in zip archive) rather than your ascii uml, I really don't understand it ;).....and don't see your excat problem....

      thanks in addvance.
      eRom

       
    • dt

      dt - 2005-02-05

      I don't have ftp right now. Can I email your sourceforge account w/ an attachment? I've found one issue where I assumed one super() would go to the top, but it must be called at each level of the heirarchy. However, I'm still getting this trace:

      No appropriate OverloadHandler found.
        Overloaded Method: null
        Used Arguments[1]: Y
        Available Handlers:
          [object SimpleOverloadHandler]
          [object SimpleOverloadHandler (A) ]
          [object SimpleOverloadHandler (Y) ]
          [object SimpleOverloadHandler (Number) ]

      Doesn't this say that I am passing in one Y? And isn't the third available handler the one that should be called?

       
      • eRom

        eRom - 2005-02-05

        Hi,

        Sure you can use my sourceforge email ;)
        I think I understanding your problem...but some .as files help me to be sure...
        If you can attach a small file(txt or fla) for explanation of what you really want can be very useful to me ;)

        Bye.
        eRom.

         
    • dt

      dt - 2005-02-11

      Hi eRom,

      I just mailed you some files. Let me know if they don't get through.

       
    • eRom

      eRom - 2005-02-12

      Okay I reveived them today (saturday 12).

      I look them on monday... ;)

      Bye
      eRom.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.