Yes, or add another class layer between, or make the method replaceable,
or make the method in A callable directly, or add a flag
Adding another class layer is the purest form, but adds the weight of
another class
Extending from A might cause too much duplication of code from B
Replaceable methods and other tricks are kind of cheating but do work
Class A
{
// subclasses replace the actual function they need called
Protected var _myFunc:Function = myFuncA;
Protected function myFunc(a:Object, b:Object):int
{
return _myFunc(a, b);
}
Protected var myFuncA(a:Object, b:Object):int
{
// A's default behavior
}
}
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of wpding
Sent: Wednesday, May 30, 2007 6:42 PM
To: [email protected]
Subject: [flexcoders] Re: Is there any way to call super.super.method in
AS3?
I guess i have to extend Class C from class A directly.
I met this problem, when i tried to extend a component. In my case ,
The Class C want to replace the myMethod in this parent class Class B,
kept others unchanged.And myMethod in Class C still need to call
A.myMethod.
--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> Sorry, but I think you're wrong or misunderstood. If a method is
> overridden, you can skip around the override like you can in some
other
> languages
>
>
>
> ________________________________
>
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>
[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of justinbuser
> Sent: Wednesday, May 30, 2007 10:50 AM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com>
> Subject: [flexcoders] Re: Is there any way to call super.super.method
in
> AS3?
>
>
>
>
>
> --- In [email protected]
<mailto:flexcoders%40yahoogroups.com> , "wpding" <wpding@> wrote:
> >
> > I want to override a method of a super class. and I can use
> > super.method to invoke the corresponding method of the super class.
> >
> > But how i can call a method of the super super class.
> > for example.
> > Class A{
> > protected function myMethod(){}
> > }
> > Class B extends A{
> > override protected function myMethod(){}
> > }
> >
> > Class C extends B{
> > override protected function myMethod(){}
> > }
> >
> > Is it possible to call A.myMethod in the function C.MyMethod?
> >
> > Thanks
> >
> Yes, exactly how you wrote it. However in order to have the top level
> function actually run before adding methods etc... with level 2 you
need
> to call super.myMethod(); from B or not override it at all in B to be
> able to access it's functionality! from C. In other words, if you
> override a function and then try to override it again in a class
> extending the one with the original override and don't call the super
> version in the intermediate class then you end up with an empty
function
> at the end.
>
> JjB
>
> -#As always I could be completely wrong, but it's not likely#-
>