This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Member Modifiers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Member Modifiers" Watch "Member Modifiers" New topic
Author

Member Modifiers

Greg Reeder
Ranch Hand

Joined: Jun 14, 2011
Posts: 99

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

Joined: Mar 13, 2009
Posts: 492

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

Joined: Jun 14, 2011
Posts: 99

Most likely it is a visual thing then with eclipse that had me confused. Oops.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Member Modifiers
 
Similar Threads
Object and Abstract, Non- Abstract Classes & Methods
KHALIDS book-CONTRADICTION on GC
DOUBT REGARDING OBJECT REFERENCES
calling a method()
Inheritance and incomptaible casting