P
pmatos
Hi all,
I have the following code:
class test {
public:
test(const std::string *n) : name(n) {}
virtual ~test() {}
const std::string * getName() { return name; }
protected:
const std::string * name; ///< Variable name.
private:
};
std:stream& operator<<(std:stream& s, const test& v) {
return s << v.getName();
}
And I get when I try to compile:
common/test.cc: In function `std:stream& operator<<(std:stream&,
const test&)':
common/test.cc:5: error: no matching function for call to `test
::getName() const'
common/test.h:14: error: candidates are: const std::string*
test::getName() <near match>
make: *** [test.o] Error 1
Any ideas on where the problem is?
Cheers,
Paulo Matos
I have the following code:
class test {
public:
test(const std::string *n) : name(n) {}
virtual ~test() {}
const std::string * getName() { return name; }
protected:
const std::string * name; ///< Variable name.
private:
};
std:stream& operator<<(std:stream& s, const test& v) {
return s << v.getName();
}
And I get when I try to compile:
common/test.cc: In function `std:stream& operator<<(std:stream&,
const test&)':
common/test.cc:5: error: no matching function for call to `test
::getName() const'
common/test.h:14: error: candidates are: const std::string*
test::getName() <near match>
make: *** [test.o] Error 1
Any ideas on where the problem is?
Cheers,
Paulo Matos