خرید بک لینک

Vote count: 0

If I have two files myclass.h and myclass.cpp how to separate this code to declaration of class member and implementation of constructor where I need to set the values in brackets {}?

std::string predefinedArgs[] = { "Some", "Other", "Strings" };

I tried header:

class Wrapper {
    public:
        std::map<std::string,std::string> arguments;
        Wrapper(int argc, char ** argv);
    private:
        int argc; char ** argv;
        std::vector<std::string> args;
        std::string predefinedArgs[12];
        void parseArguments();
};

And .cpp:

Wrapper::Wrapper(int argc, char ** argv):
  argc(argc),
  argv(argv),
  args(argv, argv+argc)
  {
      this->predefinedArgs[] = { "Jan", "Feb", "Mar", "April", "May", "June", "July", 
    "Aug", "Sep", "Oct", "Nov", "Dec" };*/
     // this->parseArguments();
  };

which is wrapper.cpp(8): error C2059: syntax error : ']'

I searched net but I caot find one serious example showing this. Don't you use classes? (just a rhetorical question)

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 21 خرداد 1395 ساعت: 23:26

صفحه بندی