plz chk my code i m having error at line 35 and 36

#include <iostream>
#include <cstring>
using namespace std;

class strng
{
  char s[30];
    public:
           strng()
           {
                   strcpy(s,"");
                   }
     string getstring()
          {
             cout<<"enter the sting:";
             cin>>s;
           return s;  
                        }
     void displaystring()
     {
           cout <<"the string is:"<<s<<endl;
           }

                   
                          
                        const strng &operator+= (const strng &t);
                           };
                           const strng &strng ::operator+=(const strng &t)
                             {
                                    strng temp;
                                    strcpy (temp.s,"");
                                    
                                    strcat(temp.s,s);
                                    strcat(temp.s,t.s);
                                    s=temp;
                                    return s;
                                    }
                                    
                                    
                                    
           main()
          {
                     strng s1;
                     strng s2;
                     s1.getstring();
                     s2.getstring();
                      s1+=s2;
                     s1.displaystring();
                             

}

errors are:
35 C:\Dev-Cpp\ddd.cpp incompatible types in assignment of `strng' to `char[30]'

36 C:\Dev-Cpp\ddd.cpp invalid initialization of reference of type 'const strng&' from expression of type 'char*'

s=temp

s a char array & temp a strng object.

return s

What's the return type of operator +=? Is is char*?

s=temp

This is never possible bcos temp is an object of strng, and s is an attribute of any object of class strng.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.