Implementing a copy on write String class using reference counting in C++
Code simplification

mystring acts essentially as a smart pointer. It's already implemented in the standard library. You can use the std::shared_ptr class. This way, mystring can just have an std::shared_ptr&lt;std::string&gt; as a member. The default copy constructor, assignment operator and the desturctor will work properly. 

Use of non-standard features

char cpy[strlen(ptr-&gt;pRC-&gt;str)+1]

variable sized arrays are not a part of the standard C++. Don't use them. If you need it, you should allocate it dynamically. 

If you use the std::shared_ptr&lt;std::string&gt; as I said above, it'll be even simpler as std::string has a proper copy constructor.  

Index

It's conventional to use size_t, not int as an index type (at least that's how an std::string works).