> The same is true for class methods, by the way. If a class method has a > reference to > an instance of the class, it can directly access the instance's ivars the > same way.
Objective-C shares a property with some languages, but not with others, that classes are actual objects. That is, if my code has "@interface Foo" and "@implementation Foo", then in addition to possibly multiple instantions of Foo objects, there is a _single_ Foo "class object". That class object occupies a non-zero quantity of memory, at its lowest level being somewhat like the combination of a single copy of a C struct, as well as some C functions, that from the Objective-C point of view, appear to be "class methods" that know all about their "class object", but that are not capable of (directly) operating on instances. C++ has the concept of class member functions, as well as class data members, but in the case of C++, it's all implemented purely by scoping. There is no actual class object. Instead class member functions know all about what is declared in the scope of the class, but do not have access to "this". Class data members, more or less, are stored and implemented just like global data variables, as individual items that are not, in general required to be actually stored adjacent to each other in a single record. Some of the really cool things that one can do with certain languages other than C++, is to manipulate those class objects as if they were some regular kind of data. I can't come up with a meaningful example for you just now though. I'm not that familiar with Javascript, but my understanding is that Javascript functions are actual objects, that are implemented by data records stored in memory, rather than, as in C or C++, simply the memory addresses of code entry points. Michael David Crawford P.E., Process Architect Solving the Software Problem li...@warplife.com http://www.warplife.com/mdc/ Don't Fix the Bugs. Fix the People that _Cause_ the Bugs. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com