AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

newbe Q

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
polilop
Guest





PostPosted: Thu Jun 16, 2005 10:56 pm    Post subject: newbe Q Reply with quote



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.



Back to top
Remi Arntzen
Guest





PostPosted: Fri Jun 17, 2005 6:52 am    Post subject: Re: newbe Q Reply with quote



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".

Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.