#include <string.h>
#include <iostream.h>
class ClassOne
{
char string[35];
public:
char Second_string[35];
friend ostream &operator<<(ostream &Xstream, ClassOne objX);
ClassOne(char *s1);
ClassOne(char *s1,int x);
};
ClassOne::ClassOne(char *s1)
{
strcpy(string,s1);
}
ClassOne::ClassOne(char *s1,int x)
{
strcpy(Second_string,s1);
x = 0; // avoid warning about unreferenced variable
}
ostream &operator<<(ostream &Xstream, ClassOne & objX)
{
Xstream << objX.string;
return(Xstream);
}
void main(void)
{
ClassOne objY("Read C-User's Journal \n");
ClassOne objZ("How to overload the << twice ?",NULL);
cout << objY;
// cout << objZ; // does not work !
cout << objZ.Second_string;
}
/* End of File */