Re: Inherited constructors
Re: Inherited constructors
- Subject: Re: Inherited constructors
- From: Ondra Cada <email@hidden>
- Date: Thu, 30 Aug 2001 11:21:18 +0200
Drew,
>
>>>>> Drew McCormack (DMC) wrote at Thu, 30 Aug 2001 09:26:21 +0200:
DMC> >I am quite afraid you are wrong in that.
DMC>
DMC> Whoa, the obj-C police are out in force today!
Stay cool, nobody forces you not to keep your wrong opinions ;)
As for init (actually, it applies for all other methods as well): we are in
OO world, and so we use inheritance. The thing says "an inherited class is a
(special) case of its superclass". One of many (good!!!) consequences is that
Class c=...
if ([c isKindOfClass:[MyClass class]])
[[c alloc] someInitDefinedInMyClass];
is quite valid, regardless c is a member of MyClass or its far descendant.
Non-inheritable constructors would therefore seriously harm OO, just as they
do in C++.
There is a plethora of other reasons why constructors as a special language
constructions are The Bad Thing, but I guess this one is sufficient.
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc