Ticket #2772 (closed defect: invalid)

Opened 19 months ago

Last modified 19 months ago

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: normal Milestone:
Component: Core Version: 0.4.1
Severity: normal Keywords: dojo.declare, initializer, override, inherit
Cc:

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

Changed 19 months ago by sjmiles

  • status changed from new to closed
  • resolution set to invalid

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.