Re: Q's about Obj-C
Re: Q's about Obj-C
- Subject: Re: Q's about Obj-C
- From: Andreas Monitzer <email@hidden>
- Date: Mon, 15 Oct 2001 18:03:04 +0200
On Monday, October 15, 2001, at 05:29 , Smith, Bradley wrote:
3. Dunno, but be interested to find out
It's ok, but be prepared for a compiler warning.
4. You've opened a can of worms here :-) AFAIK you can't have an abstract
class in Obj-C. Someone will probably go to great lengths to tell you why
and attempt to make you feel stupid for even wanting to do it.
A class is virtual when the docs say it's virtual :-)
andy
-----Original Message-----
From: Joe Chan [mailto:email@hidden]
1. When I'm defining the init method for my derived class, I
read that I need to deal with [super init] returns nil. It's not
entirely clear to me when that happens, who should dealloc the
memory of the object? It doesn't seem right to me for the
derived classes to deal with it, because if every derived class
does it, there will be two many dealloc's chained together. The
only place it seems sensible to dealloc is from the actual init
method of the class that decides to return nil for some reason.
Is that indeed the case?
2. It's not clear to me when I need to declare a method in the
header file. From my reading of the Vermont Recipes at Stepwise,
the language does not require me to declare methods in the
header file if I override the super's method, or implement a
delegate method. Does that mean the only time I need to declare
a method in the header is when I introduce a new method to the
class?
3. About the fact that all method of the same name needs to
receive the same argument and return types. I'm a little
confused by that. Does that apply only to the case of overriding
existing method? Say if I have two classes A and B that belongs
to different class hierarchies, and they both declare method foo:
<SNIP>
4. What makes a class an abstract class? In C++, that's caused
by a pure virtual function, but there doesn't seem to an
equivalent in Obj-C.
--
"He was addicted to life. But we cured him"