[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Programming it's a play

From: Pascal J . Bourguignon
Subject: Re: Programming it's a play
Date: Sun, 21 Sep 2003 16:00:35 +0200

Pete French writes:
> > I do want to know what this means. Can someone that writes a class, like 
> > the Greeter example write his own Class methods or are Class methods 
> > just inherited from the root class. Meaning you can only add instance 
> > methods.
> You can add your own class or instance methods as you like. As long as you
> bear in mind that yopu are adding them to a completely different object to the
> instance methods.
> > What is your view on a class (remember I am a VERY newbie). How can you 
> > send a message to a class when a class is not an object.
> A class *is* an object - whos primary purpose is to create other objects.
> trying to make a distinction between the written description and the
> compiled version (which you seem to be trying to do) is only going
> to confuse things. 
> Its not often that you want to send a message to a class, other than
> 'alloc' (or 'new' for alloc] init]). The acting school example muddies
> the waters a lot if you try and over-extend it to include class objects.
> Thats the trouble with all metaphors to try and explain OOP as theres
> nothing in the real world which operates in exactly the same way...

Note  however,  that  you  could  use  classes  instead  of  singleton
instances, with the only downside in Objective C that class attributes
must be normal C static variables.

Note also that when you send a message to something, you don't precise
if it's a class message or an instance message; eeing only:

                   [foo  doBar];

you cannot say if doBar is an instance method or a class method, (it's
none, it  is a message!),  or if  foo refers a  class or an  object (a
class IS an object so it does not matter).

Do not adjust your mind, there is a fault in reality.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]