Topic: Deriving ANSI string class


Author: "Georgios Pappas Jr." <gpappas@cysteine.ncsa.uiuc.edu>
Date: 1998/02/17
Raw View
Hello,

 Recently I found myself trying to extend the new ANSI string
library, in order to extend its functionality. I posted this question
to comp.lang.c++ and almost everybody replied saying that it is not
desirable (possible) to derive from string. My question is why not?
 Additionally what would be the best way to add some useful (for
me) methods to the string class. What I was trying to do was:

#include <string>
#include <algo.h>
class NewString: public string
{
  NewString& toLower(void) {transform(begin(),end(),begin(),tolower);}
}


Thanks ...
--

|  GEORGIOS J. PAPPAS Jr.    University of Illinois at Urbana-Champaign
|
|  Department of Biophysics      405 N. Mathews, Beckman Institute
|


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]