I'm having trouble with a constructor in my class and can't figure out what the problem might be. The default constructor works fine, but the one where is given a const reference to a string as argument keeps resulting in the following error:
configparser.C: In constructor `ConfigParser::ConfigParser(const std::string&)':
configparser.C:25: error: no match for call to `(const std::basic_string<char, std::char_traits<char>, std::allocator<char> >) ()'
make: *** [configparser.o] Fout 1
I have no idea what's causing this. If someone could help me out -> I would be very grateful.
Constructor funtion (doesn't do much @the moment, just returning the path-string):
configparser.C: In constructor `ConfigParser::ConfigParser(const std::string&)':
configparser.C:25: error: no match for call to `(const std::basic_string<char, std::char_traits<char>, std::allocator<char> >) ()'
make: *** [configparser.o] Fout 1
I have no idea what's causing this. If someone could help me out -> I would be very grateful.
Code:
using namespace std;
class ConfigParser {
public:
ConfigParser() throw (runtime_error);
ConfigParser(const string& configfile) throw (runtime_error);
~ConfigParser();
const int port() const {return port_;}
const string& logfile() const {return logfile_;}
const string& docroot() const {return docroot_;}
const string& typesfile() const {return typesfile_;}
const string& configfile() const {return configfile_;}
private:
int port_;
string logfile_;
string docroot_;
string typesfile_;
string configfile_;
};
Constructor funtion (doesn't do much @the moment, just returning the path-string):
Code:
ConfigParser::ConfigParser(const string& configfile) throw (runtime_error): configfile_(configfile){
cout << configfile();
}