Member variables cannot be overridden like methods. The number
variables in your classes Beta
and Gama
are hiding (not overriding) the member variable number
of the superclass.
By casting you can access the hidden member in the superclass.
Member variables cannot be overridden like methods. The number
variables in your classes Beta
and Gama
are hiding (not overriding) the member variable number
of the superclass.
By casting you can access the hidden member in the superclass.