//X.h //specification for type X #include #include using namespace std; //declare class X class X{ public: //default constructor (requires no args) X(string nm = " "){name = nm; } //access fn. string get_name(); //set fn. void set_name(string n); //I-O fns. void display(ostream& out = cout){ //display data members representing an X out << name; } void read(istream& in){ //read data members representing an X in >> name; } private: string name; //instance variable }; //declare non-member functions that accept args of type X ostream& operator<< (ostream& out, X& x); istream& operator>> (istream& in, X& x);