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

From: Mortos (thehole_at_spammer.co.uk)
Date: 03/02/04


Date: Tue, 02 Mar 2004 17:14:34 +0000

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.

public BigClass {

   public int ID_BigClass = -99;

   public MiniClass{
     public void MiniFunc(){
       //How do i get ID_BigClass?
       int intBigClassID = {Reference to instance og Big Class}
     }
   }
        
}

Thanks

-- 
I AM MORTOS!!!! (Switch spammer with blueyonder)


Relevant Pages

  • Re: private array member still public...?
    ... class that has to exectute another member function. ... If I nest it so the indexer works, I can't reference the class function SetBounds.... ... As long as the nested class keeps a reference to the containing class, it should be able to call whatever method you need it to. ... Alternatively would be for the nested class to declare an event that's raised when the indexer's setter is called. ...
    (microsoft.public.dotnet.framework)
  • Re: Nested class in component
    ... If it is a reference that your class holds, ... The nested class> will have public properties. ... with my component class holding a value variable for it. ... with my component class holding a reference variable for it. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How does a nested class reference its containing class.
    ... >> I need some quick advice. ... >> I just need to reference a containing class from the nested class. ... >> public MiniClass{ ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: why do we need "static" inner classes??
    ... I am a newbie in java and have prior OO experience in PB and .Net. ... Why do some other OO languages prevent implementation inheritance? ... have an instance of the nested class to access that field. ... There's no such thing as a "static inner" class in Java. ...
    (comp.lang.java.programmer)
  • Design patterns using anonymous inner classes
    ... In Java a nested class can be declared in any block including methods. ... The ability to create nested classes in methods in Java may seem unnecessary but combined with anonymous inner classes can provide a means of creating power design patterns. ...
    (comp.lang.java.programmer)