dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]How do you simulate an inner class in C#?


From: Gopal V
Subject: Re: [DotGNU]How do you simulate an inner class in C#?
Date: Sun, 25 May 2003 11:43:43 +0530
User-agent: Mutt/1.2.5i

If memory serves me right, Mohan Embar wrote:
> >A java inner class is simply a class that has a reference to the parent
> >class.  You just need to pass a reference to the 'outer' class to the
> >'inner' class's constructor and store it somewhere.
> 
> Thank you so much for your reply. Until I read your reply and then reread
> my C# book, I didn't realize that a C# nested class was allowed access
> to its outer class' private member variables too (provided it has
> an instance). I'm still reconciling the similarities and difference
> between both languages. I'm really glad I asked before coding something
> up. Thanks so much again.

Thanks for bringing this up right now ... The DotGNU Java to .NET compiler
was spitting out illegal code right now ... 

So to clear up a point  ... how does Java figure out the OuterClass 
reference to pick up ?

ie
      public Inner(Outer parent)
      {
          this.parent = outer;
      }

the "parent" argument in this case ?. Is it implictly provided by the 
compiler ?. If so , how ...

I would like to generate similar or identical semantics for our compiler.

Gopal
-- 
The difference between insanity and genius is measured by success


reply via email to

[Prev in Thread] Current Thread [Next in Thread]