Re: cocoa-dev digest, Vol 1 #490 - 7 msgs
Re: cocoa-dev digest, Vol 1 #490 - 7 msgs
- Subject: Re: cocoa-dev digest, Vol 1 #490 - 7 msgs
- From: Simon Stapleton <email@hidden>
- Date: Wed, 29 Aug 2001 14:38:59 +0100 (BST)
Bradley
I'm guessing (away from anything that runs *Step at the moment) that
if one were to override your 'AbstractClass' class' +alloc to throw
an exception / log a complaint / electrocute the programmer[1] it
might work. This, of course, is a complete guess.
Or, declare the interface to your 'AbstractClass' class as a formal
protocol, although that doesn't solve the whole problem.
Or your AbstractClass -init method could do this:
- (id) init {
if (self = [super init]) {
NSAssert(![self isMemberOfClass:[AbstractClass class]],
@"Eeeagh! Iron Bird!");
...
}
return self;
}
On the whole, though, I can't see a _need_ to do such a thing (which
is a hard thing to say, coming from a C++ background)
Simon
[1] as desired
>
From: "Smith, Bradley" <email@hidden>
>
Cc: Cocoa DEV <email@hidden>
>
Subject: RE: Abstract classes and methods
>
Date: Wed, 29 Aug 2001 13:11:24 +0100
>
>
Okay, classic OO example. I have an abstract class called Shape.
>
Shape is meaningless on its own but if you subclass it e.g. Square,
>
Circle
>
etc. then those classes can be used. What you don't want to do is
let
>
anyone
>
using your classes instantiate an instance of class Shape directly.
>
>
Brad
>
>
>
>
> If you describe a situation which would be impossible or at
>
> least quite
>
> inconvenient to solve without abstract classes -- I am not
>
> aware of any such
>
> -- I'll do my best to answer.
>
> ---
>
> Ondra Cada
>
> OCSoftware: email@hidden http://www.ocs.cz
>
> private email@hidden http://www.ocs.cz/oc
>
>
--__--__--
>
--
If the answer isn't obvious, the question is a distraction. Go find
an easier question.