2 Replies Latest reply on Sep 7, 2006 5:28 AM by Newsgroup_User

    delete property

    Level 7
      Hi,
      (AS 2) I have a class "mother" with four properties and a class son
      inheriting from the first.
      I want the class son inherit 3 properties (not 4): how to delete the fourth?
        • 1. Re: delete property
          Level 7
          Flooder,

          > (AS 2) I have a class "mother" with four properties and
          > a class son inheriting from the first.

          I read that probably three times before I realized you were talking
          about an ActionScript class (I thought it was a lead-in to your issue ...
          that you're in school and have a "class mother".)

          > I want the class son inherit 3 properties (not 4): how to
          > delete the fourth?

          Have you given your inheritance structure enough thought (could you
          design aroundt his)? Does it really matter if your derived class contains
          properties it doesn't need?

          The "son" is going to inherit all four, of course. In son's class file,
          you could set the undesireable(s) to null in the constructor. The delete
          statement won't do it.


          David Stiller
          Adobe Community Expert
          Dev blog, http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: delete property
            Level 7
            Flooder wrote:
            > Hi,
            > (AS 2) I have a class "mother" with four properties and a class son
            > inheriting from the first.
            > I want the class son inherit 3 properties (not 4): how to delete the
            > fourth?

            Sounds like your child class is a generalization of your mother class.
            If that's the case you may want to consider reversing the two and having
            your mother become the child instead. Or maybe creating a new
            generalized class that your mother and child each extend.

            You can't use the delete command to remove the property but you could
            instead set the property to undefined in the child's constructor if you
            really need to keep the classes the way they are.

            James O'Reilly
            www.jamesor.com