Player - // and save it in the local ID field for this...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
class Player extends Person { c static int IDCounter = 0; // shared field, a class variable int ID; // each Player has its own ID field Player () { ID = IDCounter; // get the current value of the shared counter
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: // and save it in the local ID field for this object IDCounter++; // bump up the shared counter so the next Player // object will get a different ID number } public int getID() { return ID; } }...
View Full Document

Ask a homework question - tutors are online