Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Member Modifiers

 
Greg Reeder
Ranch Hand
Posts: 99
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am almost embarassed to ask this, but as a newbie, I must. I have two objects, object1, and object2. It is very obvious that they have a relationship. Moreover, object2 IS an object1, but with one member being differant. I have created object2 so that it inherits from object1. What must I do so that I can change the member of object1 to fit object 2, and have the access to the getters and setters of all members? Does everything have to be changed to protected rather than private? It is also so, that I do not want the whole package to have access to these members and methods, just object1 and those that inherit from it.

Suggestions?
 
Hunter McMillen
Ranch Hand
Posts: 492
Firefox Browser Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greg Reeder wrote:What must I do so that I can change the member of object1 to fit object 2, and have the access to the getters and setters of all members??


What do you mean by this? Since object2 inherits from object1 it already has all of the fields that object1 has.


Hunter
 
Greg Reeder
Ranch Hand
Posts: 99
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most likely it is a visual thing then with eclipse that had me confused. Oops.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic