I made my own class string it has two attributes buff to store string and length when i compile my code without it works fine but if i use it String as an object i get alot of errors what is the reason for the errors and how can i prevent them thank you
    #include <iostream>
using namespace std;
class String
{
private:
    int length;
    char *buff;
public:
    String operator=(String &);
    String();
    String(String &);
    String(char *);
    int size(char *);
    void copy(char *);
    char getvalue(int);
    char *getbuff(){return buff;}
    void setindex(char,int);
    int getlength();
    void display();
    ~String();
};
String :: String()
{
    length = 1;
    buff = 0;
}
String :: String(String &temp)
{
    length = size(temp.buff);
    buff = new char[temp.length + 1];
    copy(temp.buff);
}
String :: String(char *a)
{
    length = size(a);
    buff = new char [length + 1];
    copy(a);
}
int String :: size(char *a)
{
    int i;
    for(i = 0;a[i] != '\0';i++)
    {
    }
    return i;
}
void String :: copy(char *a)
{
    delete []buff;
    int i;
    length = size(a);
    buff = new char[length + 1];
    for (i=0;i<length;i++)
    {
        buff[i] = a[i];
    }
    buff[i] = '\0';
}
char String :: getvalue(int index)
{
    return buff[index];
}
void String :: setindex(char value,int index)
{
    buff[index] = value;
}
int String :: getlength()
{
    return length;
}
void  String :: display()
        {
            for (int i = 0;i<length;i++)
                cout << buff[i];
        }
String :: ~String()
{
    delete []buff;
}
String String :: operator=(String &temp)
{
    copy(temp.buff);
    return *this;
}
void main()
{
    String a("r");
    String b("ee");
    b = a;
    b.display();
}
 
     
     
     
    