You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have two class VA and VB. Each one contains abstract virtual parameter.
Other classes specialize this virtual parameter.
Is it correct, that my method foo(..).. of A1 takes a parameter of type B2 in this solution?
Thanks and best regards
@paulp said (edited on Jun 13, 2013 5:46:17 PM UTC):
"asInstanceOf" means "I know what I'm doing." The method is not accepting a B2. You are lying and saying a B2 is the type it expects.
kathykiseleva (ketud) said:
ok, execuse me, I am a begginer in scala:
if I understand good, it means that I can lie and it wouldn't be stopped even by executor. That's why I can execute this method with parameter of type B2...
because I've tested this:
val s : String = "abs"
val n : Int = 5
println(n + s.asInstanceOf[Int])
and during the execution it generates an error
@paulp said:
That's correct, you can tell any lie you want and the compiler will believe it. As soon as you call "asInstanceOf", the compiler is off the hook.
I have two class VA and VB. Each one contains abstract virtual parameter.
Other classes specialize this virtual parameter.
Is it correct, that my method foo(..).. of A1 takes a parameter of type B2 in this solution?
Thanks and best regards
The text was updated successfully, but these errors were encountered: