The Wildcats controller can ask which player is current. The operation promises a Player reference, not a numeric score or a new player.
This complete Game definition returns an existing field. Player is an existing custom class; the getter does not create an instance.
If the underlying C# feature is unfamiliar, use the lesson below while reading this example.
public class Game
{
public Player CurrentPlayer;
public Player GetCurrentPlayer()
{
return CurrentPlayer;
}
}Define Game with a CurrentPlayer reference field
Offer GetCurrentPlayer with no input parameters
Return the field's existing Player reference
Do not create a Player during the queryThese words describe the class contract, not a sequence of runtime actions. Identify the types, stored members, operation inputs and results, and relationships before choosing compartments and connectors.
Game and Player.+GetCurrentPlayer() : Player. Keep the parentheses empty because there is no input.+CurrentPlayer. Put 0..1 at the Player endpoint for this possibly unassigned reference.Compare this reference with the diagram you built in Violet. Layout may differ; the source meaning, labels, and relevant connections should agree.
If CurrentPlayer refers to Jordan, the method returns that same reference. If the field is unassigned in this simple model, the method can return null; the signature alone does not guarantee a non-null object.