beautypg.com

HP Integrity NonStop J-Series User Manual

Page 197

background image

//-------------------- main --------------------------
main (){
Developer* kevin = new Developer("Kevin");
Developer* rudi = new Developer("Rudi", kevin);
Team team1;
team1.member_[0] = rudi;
team1.member_[1] = rudi;
team1.member_[2] = kevin;
cout << "team1 (before save):" << endl
<< team1 << endl << endl; // Output to user.
{
RWFile f("team.dat");
f << team1; // Isomorphic persistence of team.
}

Team team2;
{
RWFile f("team.dat");
f >> team2;
}
cout << "team2 (after restore):" << endl
<< team2 << endl << endl; // Output to user.
delete kevin;
delete rudi;
return 0;
}

Output:

team1 (before save):
[0]:Rudi at memory address: 0x10002be0
has an alias at memory address: 0x10002bd0
[1]:Rudi at memory address: 0x10002be0
has an alias at memory address: 0x10002bd0
[2]:Kevin at memory address: 0x10002bd0 has no alias.
team2 (after restore):
[0]:Rudi at memory address: 0x10002c00
has an alias at memory address: 0x10002c10
[1]:Rudi at memory address: 0x10002c00
has an alias at memory address: 0x10002c10
[2]:Kevin at memory address: 0x10002c10 has no alias.

This manual is related to the following products: