swarm-support
[Top][All Lists]
Advanced

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

question on id vs obj *


From: Ken Gosier
Subject: question on id vs obj *
Date: Thu, 31 Aug 2000 00:42:17 -0400

Quick question on declaring an object as id vs obj * (say List * to be
concrete.)

I'm working through the user guide now, and Sec 3.5 has a discussion of
the different types of declarations. Here it says that List * is no
longer allowed, since there really no List class, only a protocol, which
you may declare an id to follow.

However, I see in all the tutorials, that methods called by the
'factory' object use the List * type syntax. (Example:
tutorial/simpleObserverBug/ModelSwarm.m, createBegin, which declares obj
as ModelSwarm *)

Question: Is this type syntax necessary in calls to the factory object,
since in some sense you don't yet 'know' what kind of object you're
working on, and id can refer to any object? (This might be important,
for instance, in setting instance variables, such as in the statements

obj->worldXSize = 80;
obj->worldYSize = 80;

where you might need an explicitly stated pointer, rather than a general
id type.)

TIA for any help--
Ken Gosier

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

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