Protected member variable vs. protected accessor methods
From: Andy Redman (andy.redman_at_NOSPAM.retail-j.com)
Date: 01/20/05
- Next message: Vijay: "Empty interface and polymorphism"
- Previous message: frebe: "Re: What is an OODBMS?"
- Next in thread: Daniel T.: "Re: Protected member variable vs. protected accessor methods"
- Reply: Daniel T.: "Re: Protected member variable vs. protected accessor methods"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 20 Jan 2005 10:00:40 +0000 (UTC)
Hi
I have a class (Java) with a private member variable. I now need to
extend the class to add a sub class which adds a new function. The new
function needs access to the member variable; at this moment it does
not need to alter the variable. As I see it I have two options, a -
make the member variable protected or b - add protected accessor
methods to the super class. Is there any general rule about which
approach to take.
Cheers,
Andy
- Next message: Vijay: "Empty interface and polymorphism"
- Previous message: frebe: "Re: What is an OODBMS?"
- Next in thread: Daniel T.: "Re: Protected member variable vs. protected accessor methods"
- Reply: Daniel T.: "Re: Protected member variable vs. protected accessor methods"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|