[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RTFM question
From: |
Ralf Stephan |
Subject: |
Re: RTFM question |
Date: |
Wed, 24 Jan 2001 14:05:46 +0100 |
User-agent: |
Mutt/1.2.5i |
> Is there a way to ask an object in Obj-C what type of
> object it is?
Code example:
#include <string.h>
...
id obj;
char *objClass;
// what is there where we want to move to?
obj = [myWorld getObjectAtX: newX Y: newY];
...
objClass = [[obj class] name];
if (!strcmp (objClass, "Shark")) // there is another shark?
{
// switch position
...
this would assume your classes are derived from SwarmObject.
ralf
==================================
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.