No older revisions available
No older revisions available
~cpp #include <iostream> using namespace std; class newstring { public: char *str; newstring(char* s) { str = new char[strlen(s)+1]; strcpy(str, s); } int length() const { return strlen(str); } }; ostream& operator << (ostream& o, const newstring& ns) { cout << ns.str; return o; } int main() { const newstring s="123"; cout << s << "123"; cout << s.length(); return 0; }