What does this block of code do?

后端 未结 6 1037
鱼传尺愫
鱼传尺愫 2021-01-24 13:19

I\'m not quite sure what this means or whats it doing, Could some one elaborate?

Player player = (Player) sender;
6条回答
  •  甜味超标
    2021-01-24 13:28

    It converts sender to a Player object. Otherwise, the datatype of player wouldnt match the datatype of sender. Usually done if sender could initially have been declared as a subclass.

提交回复
热议问题