Re: How does a nested class reference it's containing class.

From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 03/02/04


Date: Tue, 2 Mar 2004 19:43:01 -0000

Mortos <thehole@spammer.co.uk> wrote:
> I need some quick advice.
> I just need to reference a containing class from the nested class. I'm
> familiar with Java but C# is proving tricky.

That's because the Java idea of an inner class with an implicit
reference doesn't exist in C#. Nested classes in C# are (mostly) like
static nested classes in Java.

-- 
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Relevant Pages

  • Re: How java passes object references?
    ... Which everybody knows, it doesn't in Java. ... The reason I think this is a useful clarification is that when you got to the part about how passing by reference might work, it seems you went off track at least partly because you didn't understand the nature of the above. ... is a pointer pointing at the memory block. ... Assignments to local variables, or even to class members, do not allocate memory. ...
    (comp.lang.java.programmer)
  • Re: The Java no pointer big fat lie!
    ... > reference types, it wouldn't be a good comparison. ... and what you can't - and there is a big difference in Java to C and C++. ... You cannot change it in the language itself, ... Thus I would distinguish pointers from ...
    (comp.lang.java.programmer)
  • Re: call by reference
    ... We started learning Java about one month ago, and they just don't believe me when i try to explain that there is a confusion when passing reference types as an argumetn to a function. ... The actual parameter must be an L-value. ...
    (comp.lang.java.programmer)
  • Re: programming concepts > specific languages
    ... >actually changes the target of the reference passed to 'function2'. ... Java from a source that was not precise about terminology. ... if I have a class MyObject and write ... I thought primitive types in particular behave in the ...
    (comp.programming)
  • Re: no pointer in Java => my problem
    ... Does Java pass objects by reference or by value? ... f could also modify the StringBuffer by appending " World" for instance. ...
    (comp.lang.java.programmer)