Opened 12 years ago

Closed 12 years ago

#2772 closed defect (invalid)

Overriding class initializer method in a sub-class causes the parent method to run AND the sub-class method as well

Reported by: guest Owned by: anonymous
Priority: high Milestone:
Component: Core Version: 0.4.1
Keywords: dojo.declare, initializer, override, inherit Cc:
Blocked By: Blocking:

Description

When you use dojo.declare to create a class with an initializer method, and you create a sub-class that inherits that class with its' own initializer method, when an object of the sub-class is instantiated it will execute the parent class' initializer method, followed by the sub-class' initializer method as well.

It seems you can successfully override all other methods in the parent class without this problem, so it appears to be limited to just the initializer method.

Change History (1)

comment:1 Changed 12 years ago by sjmiles

Resolution: invalid
Status: newclosed

This is as designed. If you want to override init time behavior, call a method from your initializer that you override in your subclass.

function() {

this.doOverridableInit();

}

Note: See TracTickets for help on using tickets.