Hi,
this
class Clarss {
      var pRoot:Clarss2
      function Clarss() {
      }
}
class Clarss2 extends Clarss {
      function Clarss2() {
      }
}

looks like a design error to me. One of the reasons you would use
inheritance is polymorphism, and reducing complexity. A super class having
to know the type of its subclasses is not good practice. Why not keep the
reference pRoot:Clarss? You can stick any subclass in there.

(ps you might want to read about the en.wikipedia.org/wiki/*Liskov*_*
substitution*_*principle )*
**
*greetz*
*JC*
**

On 3/22/07, Danny Kodicek <[EMAIL PROTECTED]> wrote:

Slightly complicated and not terribly important but annoying:

It's possible for a class to compile while self-referring:

class Clarss {
       var pParent:Clarss;
       function Clarss(tParent:Clarss) {
               if (tParent != undefined) {
                       pParent = tParent;
               }
       }
}

This compiles fine. But with inheritance this no longer works:

class Clarss {
       var pRoot:Clarss2
       function Clarss() {
       }
}
class Clarss2 extends Clarss {
       function Clarss2() {
       }
}

Now the compiler gets confused by the circular reference and tells me
"**Error** C:\...Clarss.as: Line 1: The name of this class, 'Clarss',
conflicts with the name of another class that was loaded, 'Clarss'."


It's a shame: My object structure has a bunch of objects in a tree
structure, all of which inherit the same base class. I'd like them all to
have a reference to the top-level node object, but I have to refer to it
as
an Object instead of its actual class name because otherwise it can't
compile.

Danny

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to