Suppose i have the class:
open class Organism {
open fun saySomething(){
print("Nein")
}
}
And the inheriting class:
class Person : Organism() {
override fun saySomething() {
println("Saying hello")
}
}
Why when i run this code, i still get the person implementation:
val x = Person()
(x as Organism).saySomething() // Output: Saying hello
This casting shouldn't run the Organism class implementation??
Thanks.