Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Is there any """Anti Stringizing operator #"""

Reply
Thread Tools

Is there any """Anti Stringizing operator #"""

 
 
babakandme@yahoo.com
Guest
Posts: n/a
 
      12-13-2007
Hi everybody


I've a string that contains the name of a class.

Some members told that I can use """Stringizing Operator (#)""", but
the problem is here, that I have the string, & I want something vice-
versa.
As we know with """Stringizing Operator (#)""", we can get the stirng
name of a class or ... str <--- #ClassA

But I want to instantiate a class that I have just it's name as a
string.
ClassA * clsA = new ??? <--- Str ???

How can I do it?
I don't want to use """HardCoding""".

Thanks.
 
Reply With Quote
 
 
 
 
Ian Collins
Guest
Posts: n/a
 
      12-13-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Hi everybody
>
>
> I've a string that contains the name of a class.
>
> Some members told that I can use """Stringizing Operator (#)""", but
> the problem is here, that I have the string, & I want something vice-
> versa.
> As we know with """Stringizing Operator (#)""", we can get the stirng
> name of a class or ... str <--- #ClassA
>
> But I want to instantiate a class that I have just it's name as a
> string.
> ClassA * clsA = new ??? <--- Str ???
>
> How can I do it?
> I don't want to use """HardCoding""".
>

Why all the triple quotes?

It sounds like you are looking for the factory pattern.

You can't instantiate a class by name dynamically in C++ like you can in
scripting languages.

--
Ian Collins.
 
Reply With Quote
 
 
 
 
babakandme@yahoo.com
Guest
Posts: n/a
 
      12-13-2007
Yeah my Man:>
thanks...

Actually first I didn't want to use any HardCoding...
But now I see, here the FactoryMethod Pattern works...



> Why all the triple quotes?

They are just for more attention, & make the issue more visible:>

Once again, thank you in advance...
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Stringizing escape character tokens, std. or not? Peter Nilsson C Programming 1 06-27-2007 09:55 PM
Stringizing Ravi C Programming 1 11-01-2006 10:04 PM
stringizing a hex value in the preprocessor Henry Townsend C Programming 14 12-05-2005 10:07 AM
syntax of stringizing macro Siemel Naran C++ 8 11-09-2004 12:23 AM
Template Stringizing-How should it work? Steven T. Hatton C++ 2 09-10-2004 01:06 PM



Advertisments