An override can explicitly ask its base implementation to do part of the work. The diagram should show that nested execution without inventing another object.
These are complete definitions of the same Player and Goalkeeper training behavior. Consider a Controller call casey.RecordTurn() with both counts initially zero.
public class Player
{
public int NumberOfTurns;
public virtual void RecordTurn()
{
NumberOfTurns = NumberOfTurns + 1;
}
}
public class Goalkeeper : Player
{
public int SavesPracticed;
public override void RecordTurn()
{
base.RecordTurn();
SavesPracticed = SavesPracticed + 1;
}
}The controller calls RecordTurn on Casey the Goalkeeper
The override begins on that Goalkeeper instance
It explicitly executes the Player implementation through base.RecordTurn
The base body increases NumberOfTurns
The override then increases SavesPracticed
The original call completesUse these words to follow one execution before drawing it. Keep the same order and the same alternatives as the source; simplify the wording without adding work that the code does not perform.
controller : Controller and casey : Goalkeeper.RecordTurn() to casey and start the override activation.base.RecordTurn() [Player body]. Add a nested activation for the base body.NumberOfTurns increases by 1, then end the nested activation with a dashed self-return. Below it note SavesPracticed increases by 1 as the remaining override work.Compare this reference with the diagram you built in Violet. Layout may differ; the source meaning, labels, and relevant connections should agree.
The nested activation ends first. With initial counts zero, the base body makes NumberOfTurns 1 and the remaining override makes SavesPracticed 1.