Why does this constructor-usage not compile ?
Hi,
assume a simple class like this (string-header has been included and "using namespace std" has been used):
class someclass
{
private:
string m_string;
public:
someclass(string& str){m_string = str;}
};
now I want to use this class in a programm like this
someclass* cinst = new someclass(string("test"));
but this doesn't compile without error. have you got any idea why ? the compiler-error occures at the line in the program where I want to instantiate "someclass".
if I use the following everything works fine:
string str = "test";
someclass* cinst = new someclass(str);
thank you
highhead