PDA

View Full Version : AS2 'reverse' inheritance question



mojoNYC
February 10th, 2005, 02:52 PM
i've got an inheritance chain of AS2 classes set up where i have an array in the 'child' class that i'd like to be able to access from the 'parent' class:

bottomClass.as -'parent'
topClass.as -'child'

my question/dilemma is: how can the parent access the properties of a child class...is this even possible, or am i just looking at it wrong?


thanks,
-DW

senocular
February 10th, 2005, 03:18 PM
its not possible. Super (parent) classes shouldnt be aware of sub (child) classes derived from them. Subclasses simply use superclasses to inherit properties and methods so they dont have to redefine them all over again for themselves.

What exactly is your situation? Maybe a suitable alternative can be figured out.

mojoNYC
February 10th, 2005, 04:25 PM
hi senoc!

i just figured out the way around my problem--i set a function in the child class to return a reference to the array, and then i passed it to a function inside the parent class, and it worked like a charm:)

thanks for your response,
-D