When does final mean "maybe, kinda, sorta" ?

Sean Kelly sean at f4.ca
Mon Jan 22 19:44:36 PST 2007


Andrei Alexandrescu (See Website For Email) wrote:
> kris wrote:
> [snip]
>> In short, it appears the example exhibits some poor practice 
>> (overriding private methods), is somewhat misleading (one certainly 
>> *hopes* private cannot be seen beyond module-scope), and discusses how 
>> to make "final" mean something quite other than final.
> 
> I agree about the misleading part, but I don't think that overriding 
> private methods is poor practice. In fact I think it's rich practice 
> :o). See e.g. http://www.gotw.ca/publications/mill18.htm.

It's a good design approach, but there's no reason the virtual methods 
must be private--they could be protected as well.  One could argue that 
the design is cleaner with the virtual methods private, but since the 
methods must be overridden by the derived class it's not like any 
protection attributes are being maintained anyway.  Isn't this a current 
topic of discussion on comp.l.c++.m? :-)


Sean



More information about the Digitalmars-d mailing list