Issue about casting object brackets

前端 未结 6 619
無奈伤痛
無奈伤痛 2020-12-21 01:13

I have noticed that there are two ways to cast objects (the difference is the placement of the outer parenthesis):

 1. SimpleType simpleType = ((SimpleType)          


        
6条回答
  •  心在旅途
    2020-12-21 01:58

    They are not the same.

    • The first casts the result of getType to SimpleType.
    • The second casts property to SimpleType and calls getType on it, yet the result of getType is not casted to SimpleType.

提交回复
热议问题