You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Joerg Heinicke <jo...@gmx.de> on 2005/01/09 01:33:13 UTC

inner vs. nested classes (was: svn commit: r124685)

On 08.01.2005 23:20, antonio@apache.org wrote:
> Author: antonio
> Date: Sat Jan  8 14:20:56 2005
> New Revision: 124685
> 
> URL: http://svn.apache.org/viewcvs?view=rev&rev=124685
> Log:
> inner classes -> nested classes

What's the reason for, the advantage of this change?

Joerg


Re: inner vs. nested classes (was: svn commit: r124685)

Posted by Antonio Gallardo <ag...@agssa.net>.
On Sab, 8 de Enero de 2005, 18:33, Joerg Heinicke dijo:
> On 08.01.2005 23:20, antonio@apache.org wrote:
>> Author: antonio
>> Date: Sat Jan  8 14:20:56 2005
>> New Revision: 124685
>>
>> URL: http://svn.apache.org/viewcvs?view=rev&rev=124685
>> Log:
>> inner classes -> nested classes
>
> What's the reason for, the advantage of this change?

Inner classes has an automatic access to the members of the enclosing
class (outer object). To do that, inner classes stores a reference to the
particular object.

If we don't need the connection between the inner class object and the
outer class object, then we can make the inner class "static". And this is
commonly called "nested class".

Also a nested class means:

1. We don't need an outer-class object to create an object of the nested
class.

2. We cannot access a non-static outer-class object from an object of a
nested class.

Hope this helps.

Best Regards,

Antonio Gallardo