discuss-gnustep
[Top][All Lists]
Advanced

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

dynamically instantiating a class


From: Aurelien
Subject: dynamically instantiating a class
Date: Fri, 31 Aug 2001 19:09:53 +0200

I'm trying to dynamically instantiate a class like so:

Class * clazz;
id <PeerGroup> p;

clazz = NSClassFromString ( @"Platform" );
p = (id <PeerGroup>) NSAllocateObject( *clazz, 0, NULL);
if ( [p conformsTo:@protocol(PeerGroup)] )
  NSLog ( @"Yes, this is indeed a PeerGroup" );
else
  NSLog ( @"No, this isn't a PeerGroup" );

Guess the result...

What's wrong ?

Aurélien



reply via email to

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