Re: access the owning object from an inner class

Discussion in 'Java' started by Jacob, Jul 31, 2003.

  1. Jacob

    Jacob Guest

    Andy Fish wrote:
    > Hi,
    >
    > I have an inner class that is not static. So every instance of that inner
    > class is implicitly owned by some object of the enclosing class.
    >
    > My question is, is there a piece of java syntax I can use to access the
    > 'owning' object from within my inner class, or must I have a separate
    > instance variable to point back to it.
    >
    > I notice that the netbeans debugger displays an instance variable called
    > 'this$0' which refers to the owning object, but this doesn't seem to be part
    > of the java spec



    Outer owner = Outer.this;
     
    Jacob, Jul 31, 2003
    #1
    1. Advertising

  2. Jacob

    Andy Fish Guest

    Hey, - I never knew that one - Thanks

    Andy

    "Jacob" <> wrote in message
    news:...
    > Andy Fish wrote:
    > > Hi,
    > >
    > > I have an inner class that is not static. So every instance of that

    inner
    > > class is implicitly owned by some object of the enclosing class.
    > >
    > > My question is, is there a piece of java syntax I can use to access the
    > > 'owning' object from within my inner class, or must I have a separate
    > > instance variable to point back to it.
    > >
    > > I notice that the netbeans debugger displays an instance variable called
    > > 'this$0' which refers to the owning object, but this doesn't seem to be

    part
    > > of the java spec

    >
    >
    > Outer owner = Outer.this;
    >
    >
    >
    >
    >
     
    Andy Fish, Jul 31, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. E11
    Replies:
    1
    Views:
    4,955
    Thomas Weidenfeller
    Oct 12, 2005
  2. Marijn
    Replies:
    2
    Views:
    403
    Marijn
    Aug 8, 2003
  3. Pyenos
    Replies:
    2
    Views:
    421
    Pyenos
    Dec 27, 2006
  4. Utpal Sarkar

    non-owning references?

    Utpal Sarkar, Jul 24, 2009, in forum: Python
    Replies:
    14
    Views:
    544
    Emmanuel Surleau
    Jul 26, 2009
  5. dkmd_nielsen

    Determine "owning" class?

    dkmd_nielsen, Mar 9, 2008, in forum: Ruby
    Replies:
    6
    Views:
    101
    Pit Capitain
    Mar 12, 2008
Loading...

Share This Page