-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyString.h
44 lines (34 loc) · 1.16 KB
/
myString.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef MYSTRING_H_INCLUDED
#define MYSTRING_H_INCLUDED
#include <iostream>
using namespace std;
class myString{
private:
int space = 0;
char* p;
public:
myString();
myString(const char*); //ctor
myString(const myString&); //copy ctor
~myString(); //dtor
myString operator+(const char*);
myString operator+(const myString&);
myString operator+=(const char*);
myString operator+=(const myString&);
myString& operator=(const char*);
myString& operator=(const myString&);
bool operator>(const myString&);
bool operator<(const myString&);
bool operator>=(const myString&);
bool operator<=(const myString&);
bool operator==(const myString&);
bool operator!=(const myString&);
char operator[](int index);
myString substr(int, int);
myString substr(const char*, int);
int length();
int testfunc(int);
friend ostream& operator<<(ostream&, const myString&);
friend istream& operator>>(istream&, myString&);
};
#endif // MYSTRING_H_INCLUDED