Sounds like the inheritance chain.... Theoretically, seems like when Class 3 & 4 don't implement the method, the line of execution goes up the chain until it is: Class 2.
Scott On 9/28/06, Miguel Angel Sánchez <[EMAIL PROTECTED]> wrote:
Save the example classes in a folder and look at the output console in Flash. You will see: class5 method1 class2 method1 class2 method1 class1 method1 This doesn't have any sense. If you override the method in class4, or in class3, like this, it works fine: <code> Class4 extends Class3 { public function method1():Void { super.method1(); } } </code> The output in this case is: class5 method1 class2 method1 class1 method1 But I don't wanna override the method in Class3 nor Class4 to do nothing but call super, because is not needed in a OOP language. Hans Wichman escribió: > Hi, > not 3 times? I don't think its being called twice in class2, class5's > superclass is class 4, which doesnt not redefine class2's method. > Let class 5 extend class2 for testing purposes, it probably will work > correctly and introduce class3 to see what it does. Then override > method1 in > class 3 to see what it does. > > greetz > JC > > > On 9/28/06, Miguel Angel Sánchez <[EMAIL PROTECTED]> wrote: >> >> Hi list, I'm creating a framework in my job and I have reached this >> configuration: >> >> -Class1 >> -Class2 extends Class1 >> -Class3 extends Class2 >> -Class4 extends Class3 >> -Class5 extends Class4 >> >> Class1 defines a method, for example "method1". >> Class2 overrides the method and calls "super.method1". >> Class5 overrides the method and calls "super.method1". >> >> When a instance of Class5 is created, and calls "method1", method1 is >> called twice in Class2, wtf? >> >> You can reproduce the bug using this sample classes: >> <code> >> class Class1 { >> public function method1():Void { >> trace("class1 method1"); >> } >> } >> >> class Class2 extends Class1 { >> public function method1():Void { >> trace("class2 method1"); >> super.method1(); >> } >> } >> >> class Class3 extends Class2 { >> } >> >> class Class4 extends Class3 { >> } >> >> class Class5 extends Class4 { >> public function method1():Void { >> trace("class5 method1"); >> super.method1(); >> } >> } >> </code> >> >> And this in the main timeline: >> <code> >> var a:Class5 = new Class5(); >> a.method1(); >> </code> >> >> The output is something like this: >> class5 method1 >> class2 method1 >> class2 method1 >> class1 method1 >> >> :-/ >> _______________________________________________ >> 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 > _______________________________________________ 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
-- : : ) Scott _______________________________________________ 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