Referencing a containg class instance from a nested class?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Referencing a containg class instance from a nested class?

Hybrid View

  1. #1
    Calvin Guest

    Referencing a containg class instance from a nested class?


    In a normal class you would reference the current instance with the 'this'
    keyword. How would I refrence the same (outer class) from a nested class.
    In Java, you use the syntax <Outer Class>.this.

    Thanks in advance,
    Calvin...

  2. #2
    Jonathan Allen Guest

    Re: Referencing a containg class instance from a nested class?

    You can't, nested classes are not inherently owned by the outer class.

    One option would be to pass a pointer to the outer class to the inner =
    class's constructor.

    --=20
    Jonathan Allen



    "Calvin" <DigitalQuark@msn.com> wrote in message =
    news:3bd1ad8b$1@news.devx.com...
    >=20
    > In a normal class you would reference the current instance with the =

    'this'
    > keyword. How would I refrence the same (outer class) from a nested =

    class.
    > In Java, you use the syntax <Outer Class>.this.
    >=20
    > Thanks in advance,
    > Calvin...



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center