beautypg.com

HP Integrity NonStop J-Series User Manual

Page 234

background image

{
ifstream f("bus.str");
RWpistream stream(f);
Bus* newBus;
stream >> newBus; // Restore it from an ASCII stream

cout << "Bus number " << newBus->number()
<< " has been restored; its driver is "
<< newBus->driver() << ".\n";
cout << "It has " << newBus->customers()
<< " customers and "
<< newBus->passengers() << " passengers.\n\n";

delete newBus;
}

return 0;
}

Program Output:

Bus number 1 has been restored; its driver is Kesey.
It has 4 customers and 2 passengers.

This manual is related to the following products: