24      1.   -   C++?

private:

char* s;

int    len;

};

      - assign (), -
  :

void my_string::assign(const char* str)
{
 delete [] s;

len = strlen(str) ;

s = new char[len + 1] ;

strcpy(s, str) ;

}

     .     -
      new.   -
,       ,  ,  -
  .  new     
         .  -
        n + 1 . ,
 :

my_string (40), (100);

    41  ,    . s,  101  
   ,      b. s.     
   \0.  new     , 
       .   -
 ,      -.  -
,   -,      , 
   - ().   ,  -
 new,     delete,    -
  ,     ,    -
 -.

//  -   rny_string
-my_string() { delete []s; }     //

  ,   -, -
     . , -
,  my_srting    .  -
   :

my_string(const char* p)
{

len = strlen(p);

s = new char[len + 1];

strcpy(s, p);