Home > Back-end > Consult a class array initialization problem
Consult a class array initialization problem
Time:09-26
MyString { Public: Char * STR=NULL; MyString (char * a) { STR=new char [strlen (a) + 1); Strcpy (STR, a); } MyString (MyString & amp; A) { STR=new char [strlen (a.s tr) + 1); Strcpy (STR, a.s tr); } MyString & amp; A) operator=(char * { If (STR) delete [] STR; STR=new char [strlen (a) + 1); Strcpy (STR, a); Return * this; }}; Int main () { MyString array [4]={" hello ", "the", "world", "bye"}; } In the process of compiling error "no matching function for the call to 'MyString: : MyString (MyString)'" I want to know where is wrong? Or is overloaded function again?