is there a way to create a instance in runtime with the class name?

like this code in objective-c
[[NSClassFromString(@“MyClass”) alloc] init];

thanks you~:)

Can’t you just use something like:

MyClass pMyClass = MyClass();

-OR-

MyClass * pMyClass = new MyClass();

-OR-

MyClass pMyClass;

Lance Gray wrote:

Can’t you just use something like:
>
[…]

no no, I want to treat the class name as a parameter, like this
[[NSClassFromString(@“ClassName”) alloc] init];