class Name {
public:
Name( char *, char * );
Name();
~Name();
bool operator==( const Name &n ) const;
const Name operator+=( const Name &n );
char first[ 26 ];
char last[ 26 ];
friend ostream &operator<<( ostream &, const Name &n );
friend istream &operator>>( istream &, Name &n );
};
#endif
Name::Name(char *thefirst, char *thelast )
{
}
ostream &operator<<( ostream &output, const Name &n )
{
output << n.first << n.last;
return output;
}
istream &operator>>( istream &input, Name &n )
{
input >> setw( 26 ) >> n.first;
input >> setw( 26 ) >> n.last;
return input;
}
bool Nameerator==( const Name &n ) const
{
if (n.first != n.last )
return false;
if ( n.first == n.last )
return true;
}
Nameerator +=( char )
{
Name&last += Name&first;
return &last;
}
char main()
{
Name name;
cout << "Enter full name in the form of abcdefghijk abcdefghijk:\n";
cin >> name;
cout << " The name entered was: " << name << endl;
return 0;
}
Okay I have tried what acouple of your suggestions and it still won't work. I guess I just don't understand. My teacher says that I have to use the == and += operators, so that's why that part is there. I think I just don't get the argument part and then using the main to use the class.