: [flexcoders] Re: how do you call the super's super?
maybe I want to override (and by that I mean NOT run the code in)
parent.updateDisplayList. But if I override updateDisplayList,
then at some point in my method I've got to call
super.updateDisplayList
to get anything to work
Thanks Gordon,
That's pretty much everything I needed to know.
tonio
Yes you can for each class you can just have to create a method which call's
its super and call that method from the grandchild.
Though this will probably cause some gasps and 'shame on you' responses from
the OOP hardcores, you might try copying the parent class from the SDK, make
it local to your class structure, and then modifying it as your new class,
basically porting over your new features into the parent class.
Why? I can't think of a single reason to want to do that. If you
really wanted to do that then you should be extending the grandparent
class. Also are you sure that the parent class is not calling super?
generally you do that unless you don't want that functionality.
Paul
--- In
I've often run into wanting to call grandParent.super() instead of
parent.super(), even when parent.super() will do a call to grandParent.super()
anyway. The reason for this is to override parent.super while preserving the
functionality of grandParent.super. For example, if you're overriding
Sounds to me like you are extending the wrong class. But I see your
point, it sounds like an edge case however. Can anyone provide any
real world examples?
--- In flexcoders@yahoogroups.com, Doug McCune [EMAIL PROTECTED] wrote:
I've often run into wanting to call grandParent.super() instead of
Paul,
I am not sure to which posting you are asking, 'why?' but I can give you a
specific case in which there have been needs to extend a particular class
and then at some point wish you could call super.super.someMethod().
My client needed some specialized autoComplete features that Adobe's
Can anyone provide any real world examples?
Sure.
I want to extend TreeItemRender, it's a 500 hundred line class so I'd rather
not rewrite it. The only available text presentation object in the class is
a UITextField which is instantiated in the createChildren method. I want to
replace it
maybe I want to override (and by that I mean NOT run the code in)
parent.updateDisplayList. But if I override updateDisplayList,
then at some point in my method I've got to call super.updateDisplayList
to get anything to work. But that means I'm going to run all the code in
Good example. Here is the solution to that one. DON'T call
super.createChildren()... here is why:
TreeItemRender extends UIComponent.
UIComponent has this for createChildren:
protected function createChildren():void
{
}
Calling it does nothing, you don't need to call it.
I'm going to go out
I really haven't looked at Adobes AutoComplete classes since they
aren't really part of the general release, in fact I can't find where
to download them anymore. If I recall correctly those were really ment
to be examples and not drop in components. It sounds like you are
really wanting to add
UIComponent has this for createChildren:
protected function createChildren():void
{
}
Calling it does nothing, you don't need to call it.
Hi Paul,
Okay. I could have looked that up, or just called
super.createChildren() after my code, and in this case the super would
not create the
This is just blue-sky guessing, but why not use prototype.
class Base {
updateDisplayList:Void() { /* some good code */}
}
class Child {
updateDisplayList:Void() {
// hundreds of lines of useless code
}
}
class Grandchild {
Grandchild() {
why not use prototype?
Your example assumes updateDisplayList to be a static method. The
method I'd like to call belong to the instance's grandpa not all
grandparents in general.
tonio
class Base {
updateDisplayList:Void() { /* some good code */}
}
class Child {
15 matches
Mail list logo