Friday, March 26, 2010

8 - inheritance

a) In inheritance hierarchy if the visibility of a method or variable gets interrupted at any class then all the subclasses from that class will not inherit that method or variable but they can be accessed using .

b) We can override a normal method and redefine a static method. but in both cases we cannot reduce the visibility level. Subclasses will be able to inherit the last defined method but still they can use . operator to access the other methods earlier defined

c) A variable normal or static can be redefined (methods can only be overridden) and unlike methods they can be of lesser visibility modifier
The subclasses will only see the last defined variable but still they can use . operator to access the other variables earlier defined

No comments:

Post a Comment