[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: using variable in [Class create: aZone]
From: |
Benedikt Stefansson |
Subject: |
Re: using variable in [Class create: aZone] |
Date: |
Fri, 07 Jan 2000 18:34:21 -0700 |
Joseph wrote:
> Greetings!
>
> I hope this is an easy one: I'd like to have an object's class selected
> during it's creation using a variable. Something like:
>
> - (id) createAnObject: (const char*) argClass
> {
> id mObject;
> mObject = [argClass create: [self getZone]];
> return mObject;
> }
>
<snip>
> QUESTIONS: Do I need to do something to make my string argument into a
> valid class declaration? (Similar to using sel_get_uid(argSelector) where
> argSelector is a const char*?)
>
Greetings to you,
Do something like this (the nameToObject() macro does the trick):
- createAnObject: (const char*) argClass
{
id mObject;
mObject = nameToObject(argClass);
if(!mObject)
{
raiseEvent(InvalidOperation,"Class %s not found\n",argClass);
}
mObject = [mObject create: [self getZone]];
return mObject;
}
Regards,
Benedikt
-
Benedikt Stefansson | address@hidden
CASA, Inc. | Ph : (505) 988-8807 x101
Santa Fe, NM 87501 | Fax: (505) 988-3440
==================================
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.