Class B is subclass of class A (B : A)
I initialise the class as B.init()
When invoked in A, the overriden method(
) is never called unless I use the cast:
class A {
...
self.method() //A method called
(self as! B).method() //B method called
}
Why?
Since I initialise the instance as B, I expect it's calling the overriden method, but this is not true, unless I use the cast.