Connecting Tech Pros Worldwide Forums | Help | Site Map

Instantiating an object of the cmd line arg type

Madhusudhanan Chandrasekaran
Guest
 
Posts: n/a
#1: Jul 23 '05
Hi,

Is it possible for me to instantiate an object of the type
which is passed in as cmd line argument. I know this can be done
in Java/Python having reflections. Is there any c++ way of doing this
either with rtti or some other hack.

Thanks,
Madhu





Alf P. Steinbach
Guest
 
Posts: n/a
#2: Jul 23 '05

re: Instantiating an object of the cmd line arg type


* Madhusudhanan Chandrasekaran:[color=blue]
>
> Is it possible for me to instantiate an object of the type
> which is passed in as cmd line argument.[/color]

Command line arguments in C++ are simple C-style strings.

[color=blue]
> I know this can be done
> in Java/Python having reflections. Is there any c++ way of doing this
> either with rtti or some other hack.[/color]

You can parse the command line arguments, find out what kind of object
they specify, and instantiate that kind of object.

There's no built-in feature that helps directly with that.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Closed Thread


Similar C / C++ bytes