c++ - Pass arguments to a parameter class object -


This is undoubtedly a simple question I used to do earlier too, but since working in C ++ It's been 10 years so I can not remember properly and I can not work a simple constructor call.

The idea is that by parsing the Argus in the main, the main object specifically designs to parse the arguments and returns them as needed.

Such: parameter parameters = new parameter (argc, argv), then I can call things like params. Getfile ()

The only problem is that I am getting an error in Visual Studio 2008 and I'm sure it is easy, but I think my brain is very bad.

Everything I have achieved is really original:

In the main:

  #include "stdafx.h" #include "Parameters .h "int _tmain (int argc, _TCHAR * argv []) {parameter parameters = new parameter (argc, argv); Return 0; }  

then in the parameter header:

  #pragma once class parameter {public: parameter (int, _TCHAR * []); ~ Parameter (zero); };  

Finally, in the parameter class:

  include "Stdafx.h" #include "Parameters.h" parameter :: parameter (int argc, _TCHAR * Argv []) {} Parameter :: ~ parameter (zero) {}  

I would be happy if anyone can see what is really clear in my old mind. Use

:

 

code parameter parameters (argc, argv);

When you want to have dynamic (pile) allocation, it is usually used by new operator. It gives an indicator (parameter *).


Comments