Confused about Inner Classes

BCS ao at pathlink.com
Sun Oct 21 16:14:41 PDT 2007


Reply to Janice,


> Let's get even more bizarre:
> 
> class OuterA
> {
> class Inner A
> {
> }
> }
> class VeryConfused : OuterA.InnerA
> {
> }

as already pointed out that doesn't work. What also doesn't work (but I whish 
did work) is this

class OuterA
{
  class Inner A
  {
  }
}
class OuterB : OuterA
{
  class VeryConfused : OuterA.InnerA
  {
  }
}

> I'm not sure that even makes sense. It's very hard to wrap my head
> around. Is that nonsense?
> 
> What are inner classes good for anyway?
> 

say you need to pass around handles that must be used only with the object 
the created them, or you want to be able to pass object from collection to 
collection and need to transfer ownership with them. In both cases the inner 
class can reach back to it's owner and do something.





More information about the Digitalmars-d mailing list