Hi,
you said:
restrictive not to be able to refer to a superclass within a subclass -
that's enforcing an arbitrary design principle.

But that's not what you are doing: you are referring to a subclass within a
superclass.

And with this "So it seems pretty reasonable to me that all my objects know
about all the other objects", although it might be reasonable, you are
increasing the complexity of your application. It easier when objects don't
know about each other, then when they know about each object.

In your example your superclass can no longer exist on its own. It MUST have
a subclass of a certain type. Believe me, that's weird, even for flash:)).

Your solution (adding another layer) spells coding horror to me. You tried
something to fool the compiler, and hey! it worked!.

Compare:
class Animal {
   private var isEatenBy:Animal;
}

class Cat extends Animal {
.....
}

class Bird Extends Animal {
  function Bird() {
isEatenBy = new Cat();
}
}

with:
class Animal {
   private var isEatenBy:Cat;
}

class Cat extends Animal {
///WHOOPS problem here, since isEatenBy is of type Cat i cannot put a big
dog or car here
}

class Bird Extends Animal {
  function Bird() {
isEatenBy = new Cat();  //this still works ofcourse, since its the only case
that will work
}
}

greetz
JC




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


> Danny Kodicek wrote:
> > 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.
> >
> You are mixing Classes and Instances. Classes inherit
> properties and methods from other classes.
> How the instances are linked together at execution time is
> another matter.

Well, not really. I may use the words 'class' and 'object' interchangeably
on occasion, but I'm quite aware of the distinction. Classes have
properties, instances give those properties values, classes define the
kinds
of data those values can take.

I don't think my example is that odd, really. It seems unnecessarily
restrictive not to be able to refer to a superclass within a subclass -
that's enforcing an arbitrary design principle.

Danny

_______________________________________________
Flashcoders@chattyfig.figleaf.com
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

_______________________________________________
Flashcoders@chattyfig.figleaf.com
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