2.1.12 Object Context Switching Pt. 2

A context switch is when the variable this changes.

Again, we have two Person objects: bigSister and hungryBrother.

If we step into GiveFood, we can see that this is the object with the name of Margo, and hungryPerson is the object with the name of Billy, which in the previous context was hungryBrother.

We can also see that on line 17, this is being passed into the call to the EatWith method, which is being called on the hungryPerson.

If we step into EatWith, What was previously this is now the foodGiver, and this is now the object with the name Billy.