| | | | | |

Class String Implementation Plan

namespace fsu
{
  class String
  {
    friend ostream& operator << (ostream& os, const String& s);
    friend istream& operator >> (istream& is, String& s);

  public:
    // see previous slide, plus:
    static int StrCmp (const String&, const String&);
    void       Dump   (std::ostream& os) const;

  private:
    // variables
    char *   data_;
    size_t   size_;

    // methods
    void          Clone   (const String& s);
    static void   Error   (const char*);
    static int    StrLen  (const char*);
    static void   StrCpy  (char*, const char*);
    static char*  NewCstr (int n);
  } ; // class String
} // namespace fsu

| | Top of Page | 3. C Strings, Proper Type, and String Objects - 9 of 17