#ifndef STRING_H #define STRING_H #include #include #include #include //#include "block.h" class string /*:public block*/{ protected: char *st; int len; public: string(){len=strlen(""); st=new char[len+1]; strcpy (st,"");} string(char *str); ~string(){ delete [len+1]st; } void change(char *str); char& getch(int x) { return st[x-1]; } // same as operator [] char& operator[](int i); char* getst() {char* p; p=st; return p; } void show(); char* strcats(char* p); friend void strcopy(string& dest,string& src ); friend ostream& operator<<(ostream& out,const string& s) { return out<<(char*)s.st; } friend istream& operator>>(istream& in, string& s); string& operator=(const string& rhs); string& operator+=(const string& rhs); string operator+(const string& rhs); }; #endif