Difference between asInstanceOf[ ] and isInstanceOf[ ] in scala -


what difference between asinstanceof[] , isinstanceof[]?

generally speaking, a.asinstanceof[b] performs actual cast: takes object of type , returns (if possible) object of type b, whereas a.isinstanceof[b] returns boolean indicating whether a has type b or not.

strictly speaking isinstanceof[b] looks not if of type b, if has type b in upper side inheritance tree (so if b superclass of a, isinstanceof yield true) , important notice isinstanceof works on actual object type hierarchy rather on reference type.


Comments

Popular posts from this blog

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -