Player
Learn how to create and manage the Player class.
Let’s start with the Player
class.
As observed in the UML diagram, the Player
class does not depend on other classes and can be constructed independently. Therefore, our starting point in the development process is to build this class.
As you'll see, the code for this class is not noteworthy complex. The only notable aspect is our use of list in the Player
number
and main
(line 4) classes to compile the player roster.
It is important to note that the
main
class acts as the client for thePlayer
class, serving as the environment for both constructing and testing our project. Please always remember to test at each stage.
Let’s discuss the structure of this class.
Properties
The Player
class will have the following properties: