Re: Hmmm....I apparently have the wrong idea about extending classes



public members are accessible from any method.
private members only from methods in the same class.
protected members are accessible from methods in extending classes,
subclasses (in addition to methods in the class itself)
package members, when there's no specifier written, are accessible from
methods in classes that are in the same package.

---
Paul Hamaker, SEMM
http://javalessons.com

.



Relevant Pages

  • Re: Empty class extensions?
    ... public class AMTime extends TimeOfDay { ... The subclasses may ... members of the superclass set may have the same behavior properties but ...
    (comp.object)
  • Re: UML "OR" Composition Question
    ... X only has two subclasses, ... >> complete set of the immediate superset's members, ... Therefore the diagram may hide additional classes that are ... > siblings of Y, Z. Additionally, these additional siblings aren't ...
    (comp.object)
  • Re: Q on Classes & SubClasses with protected members
    ... > "Access to protected members of the superclass would also be permitted ... > via any references of subclasses. ... > that subclasses in package different from their superclass can only ...
    (comp.lang.java.programmer)
  • Protected static members, abstract classes, object composition vs. subclassing
    ... externally-defined functions. ... members. ... This has worked for producing subclasses whose protected static fields ...
    (comp.lang.javascript)
  • Re: Subclassing and Member Access
    ... members are only seen from the actual class ... or classes in the same package ... or subclasses of it ... private int a; ...
    (comp.lang.java.help)