Re: Abstract classes and methods
Re: Abstract classes and methods
- Subject: Re: Abstract classes and methods
- From: Ondra Cada <email@hidden>
- Date: Wed, 29 Aug 2001 16:24:41 +0200
stuartbryson,
>
>>>>> stuartbryson (s) wrote at Thu, 30 Aug 2001 22:55:48 +1000:
s> I find it quite amusing that this is the exact example that I need it
s> for (except that I am working in 3D rather than 2D). I have a 3DObject
s> and then Sphere and Cube both inherit from 3DObject. I do not want
s> anyone (me) to be able to instantiate 3d object. It is easy to say
s> "Please don't instantiate 3DObject" to those who might use my code, but
s> if I could force it like in C++ this would ensure the quality of the
s> program etc etc.
Would it? Why? Let me re-phrase to 3D my note for Bradley: one can
unintentionally do a plenty of nasty things, but trying a [[[3DObject alloc]
init] autorelease] instead of [Sphere sphereWithRadius:r centre:pt] very
definitely does not look as one of them...
And:
If somebody feels he *does* need to do some "3DObject *s=[[[3DObject alloc]
init] autorelease]" to use it, let's say, as a generic shape placeholder in
some container or whatever alike, why would I prevent it? I guess the
framework's quality would be actually _lower_ with such artifical
limitations.
(Incidentally, I would not start class names with '3' ;)
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc