private is non-virtual: Stuck in C++-thinking?

monarch_dodra monarchdodra at gmail.com
Sat Oct 20 00:26:39 PDT 2012


On Friday, 19 October 2012 at 22:18:29 UTC, foobar wrote:
>
> virtual private is an obscure C++ idiom which I think the 
> argument for is extremely week. I think Walter made the right 
> decision here in favor of more readable code.
>

Really? it is the entire point of NVI. I've seen it used all the 
time. It is even used (and documented) in the STL, as the way to 
customize streams...

On Friday, 19 October 2012 at 23:14:32 UTC, Jonathan M Davis 
wrote:
> On Friday, October 19, 2012 23:22:26 monarch_dodra wrote:
>> According to TDPL, this should be legal. In particular, there 
>> is
>> an entire section about it regarding NVI.
>> 
>> No idea what it going on, but I'm curious for answers.
>
> For interfaces, where it's doing something to specifically 
> enable NVI. It never
> says that for classes.

Good point. I've not much experience with interfaces yet, so the 
difference didn't strike at me.

Yeah, once you define an interface, I guess the point of virtual 
private-ness becomes moot.


More information about the Digitalmars-d mailing list