🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.software
Article #1089

Re: class instances from class name strings

#1089
From: Moises Oliveira
Date: Tue, 13 Oct 1992 03:37
21 lines
1021 bytes
In article <BvvAv9.2tD@oceania.com> chris@oceania.com writes:
>I would really like to be able to setup a list of character strings that represent  
>classes, and at run time be able to create an instance of the class from the class name.
>
>An example:
>
>classList[] = {
>"Class1",
>"Class2"};
>
>then at run time do some type of alloc & init from the class name. ie:
>
>newClass = [[classList[0] alloc] init]
>
>Any ideas?
>
  This really belongs in csnp but....

newClass = [[objc_getClass(classList[0]) alloc] init]
 
should work.
Technical Details
Message-ID: <1992Oct13.033714.3378@nevada.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!nevada.edu!oliverm
References: <BvvAv9.2tD@oceania.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.software
Path: arc1-ca.pugleaf.net!sparky!uunet!nevada.edu!oliverm
From: oliverm@nevada.edu (Moises Oliveira )
Subject: Re: class instances from class name strings
Message-ID: <1992Oct13.033714.3378@nevada.edu>
Sender: news@nevada.edu (USENET News System)
Nntp-Posting-Host: helios.nevada.edu
Organization: Organization? Ha, don't make me laugh
References: <BvvAv9.2tD@oceania.com>
Distribution: na
Date: Tue, 13 Oct 1992 03:37:14 GMT
Lines: 25