I have this simple function :

DBConfig::DBConfig(const IniParser& ini) 
{
    m_url = ini.GetValue("host");
    m_user = ini.GetValue("db_user");
    m_pass = ini.GetValue("db_pass");
    m_schemaName =  ini.GetValue("db_schema"); 
}    

which i call from main

IniParser ini;
DBConfig *pDBConfig = new DBConfig(ini);

The method in the IniParser looks like this :

std::string GetValue(const std::string& key, const std::string& section = "");

when i point at the for example: m_url = ini.GetValue("host");

I'm getting :

the object has type qualifiers that are not compatible with the member function "IniParser::GetValue"C/C++(1086)
    DBConfig.cpp(6, 17): object type is: const IniParser

Why when i try to compile it I'm getting this error :

./data_access/DBConfig.cpp: In constructor ‘DBConfig::DBConfig(const IniParser&)’:
./data_access/DBConfig.cpp:6:36: error: passing ‘const IniParser’ as ‘this’ argument discards qualifiers [-fpermissive]
         m_url = ini.GetValue("host");
                                    ^
In file included from ./data_access/DBConfig.h:4:0,
                 from ./data_access/DBConfig.cpp:1:
/home/vagrant/cpp/libhv/build/include/hv/iniparser.h:31:17: note:   in call to ‘std::__cxx11::string IniParser::GetValue(const string&, const string&)’
     std::string GetValue(const std::string& key, const std::string& section = "");
0

There are 0 best solutions below