[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Programming it's a play
From: |
Dennis Leeuw |
Subject: |
Re: Programming it's a play |
Date: |
Sun, 21 Sep 2003 13:42:42 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020623 Debian/1.0.0-0.woody.1 |
As I am still learning programming the following part is not something I
knew. I had wondered what the - sign was for, but had not figured it out
yet.
Two types of methods exists as you know : class methods (+) and instances
methods (-). Class methods only works on the class itself, instances
methods
only works on an instance of a class (ie, an object). imho speaking of
"class objects"
is a bit misleading -- as the definition of an object is to be an
instance of a class...
you could send messages directly to the class, but it's not an object
per se...
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.
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.
From the Apple documentation:
http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/3objc_language_overview/index.html
I got:
The compiler creates just one accessible object for each class, a class
object that knows how to build new objects belonging to the class. (For
this reason it's traditionally called a "factory object.") The class
object is the compiled version of the class; the objects it builds are
instances of the class. The objects that will do the main work of your
program are instances created by the class object at runtime.
And:
To get an object to do something, you send it a message telling it to
apply a method.
...
The receiver is an object, and the message tells it what to do.
This to me means that messages can only be send to objects. That a class
is the written definition of an object. And that the compiled version is
a class object.
The last two sentences are important imho. Since a class is a written
definition it can NOT be send a message. You can only send messages to
class objects (the compiled version).
Help, help, help it gets more and more confusing.
Dennis
- Programming it's a play, Dennis Leeuw, 2003/09/20
- Re: Programming it's a play, Edward Dore, 2003/09/20
- Re: Programming it's a play, Nicolas Roard, 2003/09/20
- Re: Programming it's a play, Dennis Leeuw, 2003/09/20
- Re: Programming it's a play, Nicolas Roard, 2003/09/20
- Re: Programming it's a play, Pascal J . Bourguignon, 2003/09/20
- Re: Programming it's a play,
Dennis Leeuw <=
- Re: Programming it's a play, Pete French, 2003/09/21
- Re: Programming it's a play, Dennis Leeuw, 2003/09/21
- Re: Programming it's a play, Pete French, 2003/09/21
- Re: Programming it's a play, Pascal J . Bourguignon, 2003/09/21
- Re: Programming it's a play, Dennis Leeuw, 2003/09/21
- Re: Programming it's a play, Pascal J . Bourguignon, 2003/09/21
- Re: Programming it's a play, Pascal J . Bourguignon, 2003/09/21
Re: Programming it's a play, Pascal J . Bourguignon, 2003/09/21
Re: PATCH: Merge objc-improvements-branch to mainline, Ziemowit Laski, 2003/09/24