Advertisement
KShah

Untitled

Nov 12th, 2021
613
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. String(const char* char_array) : size(strlen(char_array)), arr_size(size), array(new char[arr_size]) {
  2.     memcpy(array, char_array, size);
  3.   }
  4.  
  5.   String(const int n, const char c) : size(n), arr_size(size), array(new char [arr_size]) {
  6.     memset(array, c, size);
  7.   }
  8.  
  9.   String() = default;
  10.  
  11.   String(const String& old_string) : size(old_string.size), arr_size(size), array(new char[arr_size]) {
  12.     memcpy(array, old_string.array, size);
  13.   }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement