470,572 Members | 2,642 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,572 developers. It's quick & easy.

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

Hi everybody:D
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.
Dec 13 '07 #1
2 1818
ba********@yahoo.com wrote:
Hi everybody:D
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.
Dec 13 '07 #2
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...
Dec 13 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by John Pass | last post: by
9 posts views Thread by Emanuele Aina | last post: by
8 posts views Thread by av | last post: by
2 posts views Thread by John Goche | last post: by
8 posts views Thread by Prateek | last post: by
14 posts views Thread by Jess | last post: by
1 post views Thread by livre | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.