I have to construct a class for strings. C++ already has one, but my assignment is a home-made version. I am very lost as to how to make the constructor work. I have toyed with a few things, but I was given a header file to follow and I have no clue what to do. Any help would be appreciated.
I am clueless as to what to do. The constructor seems to be giving me the most trouble, I am not even sure where to start. All the other parts of the assignment seem possible, but the constructor is confusing me with the Capacity, Length, and * Mem.Code:class String { private: unsigned Capacity; // Number of memory locations reserved unsigned Length; // Number of memory locations in use char * Mem; // Pointer to memory to hold characters public: // Construct empty string // String() { Mem = NULL; Capacity = 0; Length = 0; }
Please help with comments, explanations, example code, or anything you think that would be helpful.



LinkBack URL
About LinkBacks



