- Your
getS()
methods from parent class is inherited in Child class and hence it is available for Child object. - Overriding is only for methods and not for instance variables.
- So even if you define a new variable with same name, it will not take effect as it will not be overridden
↧
Answer by Prasad Kharkar for Java this in parent and child not working as expected
↧