class string

I have to design a class string that has two member variables, (a)aString, an array of type char with 60 entries,
(b) length, and int representing the length of the string.

In addition, the class should have the following member functions.
(a) The constructors for this class must cater for
- no arguments, in which case the instance to be created is the empty string,
- two arguments, a pointer to char and an int, denoting the string of characters to be represented and its length, and
- one argument, a pointer to char indicating the string that must be represented, in which case the constructor must work out the length of the string.
(b) Overload the input and output operators << and >>.
(c) Define a member function reverse that reverses the string. For example, if the instance of string called str represents the string "abcde" then the same instance will represent the string "edbca" after str.reverse(); is executed.

I have to string test these with the following code
string a;
cout << "a is " << a << "\n";
string b("12345");
string c("12345",3);
cout << "c is " << c << "\n";
c = a;
a = b;
cout << "a is " << a << "\n";
b.reverse();
cout << "a is " << a << "\n";
what have you got so far?
Topic archived. No new replies allowed.