Ticket #84 (closed enhancement: fixed)
Classes without explicit initializers should inherit the ones from the base class
Reported by: | Chuck | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | Cobra 0.9 |
Component: | Cobra Compiler | Version: | 0.8.0 |
Keywords: | Cc: |
Description
Classes that don't declare explicit initializers currently get one parameterless initializer. This is rather annoying when building a class hierachy. Imagine a class such as:
class NamedPoint def init(name as String, x as int, y as int) ... def init(x as int, y as int) ...
A subclass such as:
class MyNamedPoint inherits NamedPoint pass
Should support this out of the box:
p = MyNamedPoint('origin', 0, 0) q = MyNamedPoint(1, 1)
In fact, there is no reason to believe that a parameterless initializer is a good guess when the base class does not have any.
This might affect existing code, so we may need a new -legacy: option to force the old behavior.
Change History
Note: See
TracTickets for help on using
tickets.