Instantiating an object of the cmd line arg type

  • Thread starter Madhusudhanan Chandrasekaran
  • Start date
M

Madhusudhanan Chandrasekaran

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
 
A

Alf P. Steinbach

* Madhusudhanan Chandrasekaran:
Is it possible for me to instantiate an object of the type
which is passed in as cmd line argument.

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

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.

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,204
Messages
2,571,065
Members
47,672
Latest member
svaraho

Latest Threads

Top