Let's perform another small exercise by implementing functions that are required to use QDataStream to serialize the same simple structure that contains the player information that we used for text streaming:
struct Player { QString name; qint64 experience; QPoint position; char direction; };
For this, two functions need to be implemented, both returning a QDataStream reference that was taken earlier as an argument to the call. Apart from the stream itself, the serialization operator accepts a constant reference to the class that is being saved. The most simple implementation just streams each member into the stream and returns the stream afterward:
QDataStream& operator<<(QDataStream ...