POV-Ray : Newsgroups : povray.off-topic : Quick C++ question... : Re: Quick C++ question... Server Time
5 Sep 2024 03:21:02 EDT (-0400)
  Re: Quick C++ question...  
From: Warp
Date: 12 Nov 2009 14:58:57
Message: <4afc6901@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> Darren New <dne### [at] sanrrcom> wrote:
> > Oh! OK. Heh. I don't think I've ever had the pleasure of needing or using 
> > inner classes before, in any language, so it didn't leap out at me.

>   Why not? It aids in limiting the visibility of types, and thus increases
> modularity. If a class uses a helper class which is completely exclusive
> to that class (and might even be a friend), then it makes sense that the
> helper class is defined as a private inner class.

  Forgot to mention practical examples.

  Ever wondered what, for example, std::list<int>::iterator is? Well,
surprisise surprise, it's an inner class inside std::list<int>. It's so
related to std::list that it makes a lot of sense to make it an inner class.

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.