![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Warp wrote:
> The inherited class using things like virtual functions and multiple
> inheritance does not affect the base struct part.
Cool. Not even C# manages that. (You can't put virtual methods on a value
class.) Another win for C++ MI.
--
Darren New, San Diego CA, USA (PST)
I ordered stamps from Zazzle that read "Place Stamp Here".
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Darren New <dne### [at] san rr com> 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.
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Warp <war### [at] tag povray org> wrote:
> Darren New <dne### [at] san rr com> 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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Warp wrote:
> Darren New <dne### [at] san rr com> 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?
I just haven't needed it. In languages where there's specific header files
(i.e., C and C++), I don't include the header file for the child class. In
languages where there's specific support for the concept (C#) I use the
internal visibility. I haven't done much in Java since they invented inner
classes, but those aren't really "invisible" so much as obsfucated anyway,
so there didn't seem to be a benefit there either.
I.e., everyone already has modular visibility controls, so putting it inside
a class rather than a namespace didn't seem worthwhile.
> 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.
Yes it does. I didn't say it was bad. I just said I never found the need to
use one. The existent mechanisms were already sufficient.
--
Darren New, San Diego CA, USA (PST)
I ordered stamps from Zazzle that read "Place Stamp Here".
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Darren New wrote:
> Yes it does. I didn't say it was bad. I just said I never found the need
> to use one. The existent mechanisms were already sufficient.
Altho your point of a public class with an embedded iterator is a good one.
I even expect C# uses embedded classes to implement that in the libraries,
now that you mention it. Of course, the name isn't exposed outside the class
in any way, so it's hard to tell without reading actual source code.
Instead, there's a call called "getEnumerator" or something on the
collection that returns something that inherits the Enumerator interface or
some such. You don't directly instantiate an iterator, but rather ask the
class for one.
--
Darren New, San Diego CA, USA (PST)
I ordered stamps from Zazzle that read "Place Stamp Here".
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |