[Bluej-discuss] private fields of superclass in object inspector

Michael Kölling M.Kolling at kent.ac.uk
Fri Dec 14 13:51:46 GMT 2007


On 14 Dec 2007, at 13:40, Dr. Michael Städler wrote:

> Hi,
>
> I am a lecturer in business informatics and teach a Java beginners  
> course with BlueJ. I am very happy to have such a pedagocically  
> useful IDE. Just one feature (?) makes me wonder: like my subject  
> says, it's about private fields of superclasses. They are visible in  
> instances of subclasses when I look in the "object inspector". This  
> is in version 2.12 and also in 2.2. Why? Since private fields are  
> not inherited, wouldn't it be better to not show them accordingly?

I don't think that it is correct that private fields are not inherited.

Private fields are not _accessible_ in subclasses, but they are  
present as part of the state of subclass objects (and must be to  
support the inherited methods).

The object inspector in BlueJ shows the internals of an object (for  
debugging purposes), not the public view.

So if I create a Student object, which has a 'name' attribute  
inherited from Person, and I want to check whether it has been  
initialised properly, or I want to check whether the 'changeName'  
method works properly, then I need to see the inherited part of the  
object's state.

I don't think students can understand inheritance of fields properly  
if these were not shown.

Michael



More information about the bluej-discuss mailing list