c++ error: qualifiers can only be specified -
i not sure why generating error:
const class mystring { public: mystring() { _len = 0; _str = null; } mystring(const char* in); mystring(const mystring&); ~mystring(); int set(const char*); int set(const mystring&); int setlength(int len) { _len = len; return 0; } int getlength() { return _len; } char * getstr() { return _str; } int getstr(char* out) const; mystring operator+(const mystring & in); mystring operator+(const char* in); mystring operator+(const char in) {const char* temp = ∈ return *this + temp; } mystring operator=(const mystring & in) { this->set(in); return *this; } mystring operator=(const char* in) { if(in) this->set(in); return *this; } mystring operator=(const char in) {const char* temp = ∈ return *this = temp; } mystring operator+=(const mystring & in) { this->set(*this + in); return *this; } mystring operator+=(const char* in) { if(in) this->set(*this + in); return *this; } mystring operator+=(const char in) { return (*this + in); } int operator==(const mystring& in); int operator!=(const mystring& in); int operator==(const char* in); int operator!=(const char* in); friend ostream& operator<<(ostream& os, const mystring & in) { os << in._str; return os; } protected: char * _str; int _len; };
the error being generated @ last line. code before definition 'standard' #includes , using namespace std.
the error message posted not complete, nevermind that.
long story short: remove const
qualifier @ top of class declaration, 1 before class
keyword. can add cv-qualifiers (const / volatile
) either on variables or methods.
Comments
Post a Comment