c++ - Cannot access private member declared in class 'CCustomCommandLineInfo' -


i trying add command-line interface existing mfc application, , found class online at website. have adapted needs , when try build error reads "error c2248: 'ccustomcommandlineinfo::ccustomcommandlineinfo' : cannot access private member declared in class 'ccustomcommandlineinfo'" here's code:

class ccustomcommandlineinfo : public ccommandlineinfo {   ccustomcommandlineinfo()   {     //m_bexport = m_bopen = m_bwhatever = false;     m_bnogui = m_bamode = false;   }    // convenience maintain 3 variables indicate param passed.    bool m_bnogui;            //for /nogui (no gui; command-line)   bool m_bamode;            //for /adv (advanced mode)  // bool m_bwhatever;       //for /whatever (3rd switch - later date)    //public methods checking these. public:   bool nogui() { return m_bnogui; };   bool amodecmd() { return m_bamode; };   //bool iswhatever() { return m_bwhatever; };    virtual void parseparam(const char* pszparam, bool bflag, bool blast)   {     if(0 == strcmp(pszparam, "/nogui"))     {       m_bnogui = true;     }      else if(0 == strcmp(pszparam, "/adv"))     {       m_bamode = true;     }    // else if(0 == strcmp(pszparam, "/whatever"))     // {     //  m_bwhatever = true;     // }   } }; 

and here's have in initinstance()

// parse command line (cmdline.h) ccustomcommandlineinfo oinfo; parsecommandline(oinfo); if(oinfo.nogui())   {     //   } else if(oinfo.amodecmd())   {     // whatever   } 

how go fixing this?

you have:

class ccustomcommandlineinfo : public ccommandlineinfo {   ccustomcommandlineinfo()   {     //m_bexport = m_bopen = m_bwhatever = false;     m_bnogui = m_bamode = false;   } 

that makes default constructor private function. that's why can't use:

ccustomcommandlineinfo oinfo; 

make default constructor public.

class ccustomcommandlineinfo : public ccommandlineinfo {   public:   ccustomcommandlineinfo()   {     //m_bexport = m_bopen = m_bwhatever = false;     m_bnogui = m_bamode = false;   } 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -