#ifndef __MYSTRING_H__
#define __MYSTRING_H__

#include <iostream>

class MyString {

public:

    // default constructor
    MyString();

    // constructor
    MyString(const char* p);

    // destructor
    ~MyString();

    // copy constructor
    MyString(const MyString& s);

    // copy assignment
    MyString& operator=(const MyString& s);

    // returns the length of the string
    int length() const { return len; }

    // operator+
    friend MyString operator+(const MyString& s1, const MyString& s2);

    // put-to operator
    friend std::ostream& operator<<(std::ostream& os, const MyString& s);

    // get-from operator
    friend std::istream& operator>>(std::istream& is, MyString& s);

    // operator[]
    char& operator[](int i);

    // operator[] const
    const char& operator[](int i) const;

private:

    char* data;

    int len;
};

#endif // __MYSTRING_H__
