Re: Beginner's questions
Re: Beginner's questions
- Subject: Re: Beginner's questions
- From: Drew McCormack <email@hidden>
- Date: Tue, 16 Oct 2001 14:02:40 +0200
Q) What about abstract class (in the java meaning of abstract class) ?
A) I've seen the previous answer and ok but it's still too bad...
Obj-C doesn't enforce things like C++ or java. You can still have an
abstract class, but it will be more in the documentation than in the
code. You could also check out "class clusters", which I guess are
related. There is a piece of apple documentation somewhere (legacy)
about them. Should be in the documentation on your hard disk.
Q) Is there anything like a private, protected, public method in
Objective
C. I know that we speak of message and not of method but still, it
would be
nice to restrict the availability of messages considering their scope
(am I
clear ?)...
The way you do this is to put a separate interface block with the
private methods declarations in the ".m" file, rather than in the
header. This is also a trick used in C programming.
So there is no explicit keyword to make a method private, but it is
possible to hide methods.
Q) Still in java, is the notion of package (or something close)
available to
organize my classes ?
Not that I am aware. I think the usual approach is to prepend something,
as in "NSObject".
Q) Isn't the [[receiver message1:xxx] message2:yyyy:zzzz] a little
outdated
? Especially on a mac keyboard where no [ or ] is available ? Yes I
know how
to type them but still...
Matter of opinion, I guess. I quite like the smalltalk way. Your
messages read more like sentences.
That's all for now, I am starting to read Cocoa and, even though the
Obj C
syntax seems weird, I like what I see so I go on...
It is weird at the beginning, but after a while you wonder why you ever
did it any other way.
Regards,
Drew McCormack