I think those instructions are pretty clear.
Create a class, that is derived from the string class. You will have to create your own constructor(s), the encryption method, and ideally input and output methods. See below for a general framework
#include <iostream>
#include <string>
using namespace std;
class myString: public string
{
private:
public:
myString( );
myString( string source );
void modify( );
string theString; //should be private, and need to include input output methods
};
myString::myString( )
{
theString = "";
}
myString::myString(string source )
{
theString = source;
}
void myString::modify( )
{
theString[0] = 'A';
}
int main()
{
myString s1;
myString s2( "Hello, World" );
cout << s1.theString << endl << s2.theString << endl << endl;
s2.modify( );
cout << s2.theString << endl;
return 0;
}
Reputation Points: 1268
Solved Threads: 228
Posting Virtuoso
Offline 1,895 posts
since Aug 2007