string :: string(char *s)
{
length = strlen(s);
sptr = new char[length + 1];
strcpy(sptr, s);
}
string :: string(string &s1)
{
length = s1.length;
sptr = new char[length + 1];
strcpy(sptr, s1.sptr);
}
string :: string(int size)
{
length = size;
sptr = new char[length+1];
*sptr = '\0';
}
评论0
最新资源