ok, so i should override whatWeHave, but that does not create dependence
if all i'm doing is overriding, whatWeHave does not have to be defined.
And ASWC is right also, but the idea is really just for the two classes,
they are "married" to one another.
The basic idea is variable specific methods (and the variables themselves) in one class, and the use of those variables in another.
This whole with(super) thing actually works!
(even on a big scale, that's what led me to this question)
I stumbled upon it today as a quick way
to separate out code
NeedsExtension becomes the upper class, no? ...No!
So the real quedtion is why does it work!?
For some reason with(super) does not reference Sprite,
it does reference NeedsExtension it's like saying super.whatWeHave(); ...
ok, this is what is going on, i just saw it after starting to write this..
It is doThat that calls for the super
so the "super" is doThats (the functions) super - NeedsExtension
This is true even if the protected function is called from outside the constructor.
The two classes are one, the one does not work without the other.
And Sprite comes along for the ride.
If you wanted you could get crazy with it and define everything that the "first extender" will need:
ActionScript Code:
pacakge
{
public class MustExtendMe extends Sprite{...//protected stuffs}
...
public class eventDefenition extends Event{...}
public class arrayDefenition extends Array{...}
...
}
then for types NeedsExtension would just use those instead.
If you wanted you could go as far as no imports in NeedsExtension, so then a more appropriate name for MustExtendMe would be NeedsExtensionsVariables.