title: Is it ever a good idea to break encapsulation?
body: <p>I am just starting to learn about encapsulation, and I stumbled upon two functions used by std::string that seems to break its encapsulation.</p>
  
  <p>Regarding c_str() and data() from <a href="http://www.cplusplus.com/reference/string/string/c_str/" rel="nofollow">http://www.cplusplus.com/reference/string/string/c_str/</a> and               <a href="http://www.cplusplus.com/reference/string/string/data/" rel="nofollow">http://www.cplusplus.com/reference/string/string/data/</a></p>
  
  <p>"The pointer returned points to the internal array currently used by the string object to store the characters that conform its value".</p>
  
  <p>For someone just learning about OO programming, is it ever a good idea to break encapsulation? 
  How about for someone who is more advanced? </p>
  
  <p>As an aside, it seems like this is different behavior from C++98. Why do you believe that they made these changes?</p>
  
  <p>Thanks  for your time.</p>