Re: OOP Clarification: difference between classes and instances, compare with C++
Re: OOP Clarification: difference between classes and instances, compare with C++
- Subject: Re: OOP Clarification: difference between classes and instances, compare with C++
- From: Thomas Lachand-Robert <email@hidden>
- Date: Tue, 1 Jan 2002 17:20:31 +0100
Le mardi 1 janvier 2002, ` 02:52 , John C. Randolph a icrit :
Hmmm. You are working at Apple, now right (or soon will you)?
I start on Wednesday, 01/02/2002.
That's tomorrow, not the 1st of february, right? Good luck there.
Why not writing an html page about this sort of subject (and other FAQ
of this list)?
That's a good suggestion. Some of this is in the Obj-C FAQ, I believe
(which is frequently posted to the comp.lang.objective-c newsgroup.)
This FAQ should be copied in Apple's doc.
This could be put together with the Cocoa documentation. I know there is
"OOP and the Objective-C language", but I believe that most people don't
read it because it is not html and/or they assume they already know OOP
because they know C++ and/or it is just too lengthy.
Actually, it's not all that long, and it is available in HTML form, at
file:///Developer/Documentation/Cocoa/ObjectiveC/index.html
on any machine with the current (December 2002) Developer tools installed.
It may have been in earlier releases as well.
Didn't notice it was there, since it wasn't in previous release. The
"Class objects" section seems relatively clear to me, but apparently some
people didn't find it, or didn't understand it.
Also I feel a page describing the main differences between C++ and Obj-C
(in an objective way ;-) would be very useful.
That's a pretty tall order, considering how much C++ adds to C. It's a
whole lot less work to describe the C to Obj-C differences.
No that's not what I meant. The idea is to describe the main differences
between the OOP implementation in Obj-C and C++, for people who already
know C++. So this wouldn't be a description of C++, but of Obj-C, just
with a different point of view. The main points could be:
- in Obj-C, "id" means "any object"; and in Cocoa, almost all classes
derivate from NSObject;
- in Obj-C every method is "virtual", every object is dynamically
allocated, and all classes are dynamic;
- in Obj-C there is class objects;
- in Obj-C it is possible to call a method knowing only its name (as a
string);
- in Obj-C you can extend a class or change some of its methods even after
it has been defined;
- in Obj-C there are formal protocols, roughtly equivalent to abstract
pure classes in C++;
(etc.)
Also it should be useful to recall that all constructs of C++ can be used
in Cocoa, by using Obj-C++.
Thomas Lachand-Robert
********************** email@hidden
<< Et le chemin est long du projet ` la chose. >> Molihre, Tartuffe.