Barry Fishman <[email protected]>:
> If you need to redefine "initialize" to do what you want, this is a
> clear indication that you might using the wrong abstraction.
If I have an IS-A relation, that is often described as class hierarchy.
The general question here is, is IS-A-WHOSE a valid basis for class
derivation?
For example,
A thunk IS-A function WHOSE argument list is empty.
A square IS-A rectangle WHOSE width equals its height.
Green light IS electro-magnetic radiation WHOSE wavelength is 520 nm.
A Texan IS-AN American WHOSE permanent address is in Texas.
In many programming languages, such restrictions are routinely expressed
in object constructors:
class GreenLight(Radiation):
def __init__(self):
Radiation.__init__(self, wavelength=520e-9)
Marko