Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / June 2005

Tip: Looking for answers? Try searching our database.

newbe Q

Thread view: 
polilop - 16 Jun 2005 23:56 GMT
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".


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.