I would like to declare the type of an object based on user input.
Ie. I would like to do the following:
string obj = //get from command line arguments
if(Format == "obj")
{
ObjFile Obj;
Obj.Read(InputFile);
Obj.DoSomething();
Obj.Write(OutputFile);
}
else if (Format == "vtk")
{
VtkFile Vtk;
Vtk.Read(InputFile);
Vtk.DoSomething();
Vtk.Write(OutputFile);
}
//the list goes on...
But to possibly 10-ish file types, without having a 5 page long list of if's. Is this possible? Something like
//somehow make an object of the correct type called GoodObject
GoodObject.Read(InputFile);
GoodObject.DoSomething();
GoodObject.Write(OutputFile);
Thanks,
Dave