Re: Object Oriented Subclassing Question
Re: Object Oriented Subclassing Question
- Subject: Re: Object Oriented Subclassing Question
- From: Jonathan Rochkind <email@hidden>
- Date: Mon, 8 Mar 2004 11:46:05 -0600
[I've restricted my reply to just one list. I have a personal pet
peeve against cross posting to both lists].
The idea of 'overriding' _variables_ in Java is a confusing one. You
can't really over-ride variables in Java. By giving a variable the
same name in a sub-class and a super-class, you've "shadowed" the
superclass implementation, not over-ridden it. The super-class
variable is still there, it's just kind of hidden.
The whole thing has never made much sense to me, so I can't explain
it very well. I try to avoid the need to deal with it, by
over-ridding _methods_, which work as expected, and leaving variables
alone.
But look up info on the web about Java and variables and "shadowing"
and such. Or get a book on Java. Here's one web page, just the
first one I find on Google:
http://java.sun.com/developer/TechTips/2000/tt1010.html#tip2
--Jonathan
At 1:18 PM -0600 3/6/04, James Cicenia wrote:
Hello -
I have a component called EditLists and I want to subclass it
for each of my lists. i.e. EditRoles, EditSystems, etc.
at the top of my EditLists class I have:
/** @TypeInfo eo.PortfolioRole */
public PortfolioRole newItem;
public PortfolioRole theItem;
public String QUERY_DELETE_VALUE = "rosterMembers.role.value";
public String QUERY_OBJECT = "PortfolioRole";
Can I override those public variables? It seems I can't. My component
thinks the subclass is actually the superclass. Newbie OO question I
am sure, but would like to understand this pattern a bit more.
I just need to change those and everything should work great.
-James Cicenia
_______________________________________________
WebObjects-dev mailing list
email@hidden
http://www.omnigroup.com/mailman/listinfo/webobjects-dev
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.