i have an abstract class (person) with abstract methods
allso i have in that abstract class variables (name, surename, age), it is
inhereted by classes like
proffesor, student...
what access modifier should i put?
I can not put private only public and protected?
what is the difference between public and protected?
The problem is that whichever i put i can allways get to the variables in
the superclass becouse i can not put private access modifier.
Remi Arntzen - 17 Jun 2005 07:52 GMT
Public member fields are just that "public" any class that has access
to the Declaring class "person" has access to the fields "name,
surname, age".
Protected member fields are "protected" from other classes, in that any
other class that does not extend class "person" can not access the
fields "name, surname, age", however the classes "professor,
student..." can access the fields, because they extend (are subclasses
of) "person".