A boolean cant suddenly become another primitive data type:
hasDataType is either true or false it cant just become an integer or a float
but casting is converting similar data types, like you can cast a float to an int and vice versa as they are both numbers.
can you explain more what you not getting?
maybe watch this video, i found it good and it cleared a lot up