Lack of `outer` keyword makes inner class dup implossible
S.
dnewsgr at mephit.kicks-ass.org
Sat Jul 15 00:50:11 PDT 2006
On 2006-07-14 21:10:41 -0700, "Derek Parnell" <derek at psych.ward> said:
> Ok, assuming that 'nested' and 'inner' are synonymous in this
> discussion, it appears that their main purpose is to provide scope
> limitation. That is, the functionality provided by inner
> classes/functions is restricted to, and there by only relevant to, the
> containing class/function.
>
> I use inner functions this way because I can see their utility, but can
> someone supply a good inner class example? As far as I can see, an
> instance of an inner class only makes sense in the context of its
> parent class and is thus reliant on the 'outer' class for relevancy.
> I'm having trouble visualizing where this might be a Cool Thing(TM).
I'm writing a Sudoku solver. I have a Cell class, an individual cell
is only relevant in the context of the board. It makes various things
a Cell might want to do easier having access to information about the
board it lives on. I could pass it a board instance when I create it
like I did originally, but I saw nested classes and thought it was a
nifty feature.
-S
More information about the Digitalmars-d
mailing list