In article <dMKdncnvOOCKQILcRVn-oA@comcast.com>, Dave Townsend
<datownsend@comcast.net> writes[color=blue]
>On a slightly different thread, I remember seeing some Microsoft
>COM code which played games with nested classes by doing some
>pointer arithmetic with "this". My recollection is a
>bit fuzzy, but I seem to remember the nested class was able to access
>private data in the parent.[/color]
Well that has always been allowed (till the Standard was published) by
declaring the nested class a friend of the enclosing class) The wording
of the Standard (clearly a defect) actually makes that impossible in a
Standard conforming way. The resolution of the defect by an almost
unanimous vote of those present (a very rare occurrence) was that nested
classes should have full access to their enclosing class.
[color=blue]
> Is this just pure evil,[/color]
Is what pure evil?
[color=blue]
> or is there a standard
>compliant way of doing this?[/color]
At the moment, no but in practice yes. Either have a compiler that
accepts the relevant friend declaration or one that accepts the defect
resolution (all C++ compilers do one or the other or both)
[color=blue]
> It would seem to be a useful mechanism
>to break up the functionality of the parent class by using nested classes
>each specialized in one particular behavior/functionality.[/color]
--
Francis Glassborow ACCU
Author of 'You Can Do It!' see
http://www.spellen.org/youcandoit
For project ideas and contributions:
http://www.spellen.org/youcandoit/projects