Overloading/Inheritance issue

Derek Parnell derek at nomail.afraid.org
Tue Aug 7 18:24:25 PDT 2007


On Tue, 07 Aug 2007 18:03:43 -0700, Sean Kelly wrote:

> Bill Baxter wrote:
>> Walter Bright wrote:
>>> James Dennett wrote:
>>>> This might not sit well with those who think that virtual is
>>>> a good default though.  I'm not one of them; I've never seen
>>>> problems caused by non-virtual as default,
>>>
>>> I, for one, have had several severe and very hard to find bugs caused 
>>> by non-virtual as the default. It's something that defies visual 
>>> inspection looking for them.
>> 
>> Is there some way currently to force methods to be non-virtual?  Does 
>> 'final' do that?
> 
> Yes, that's what 'final' is for.  In my D code, it's rare that I'll 
> write a function that isn't final.

I'm about to make a fool of myself again, but in my defence, I'm not a
frequent O-O practitioner. 

So can someone remind me ...

"virtual" means that a member can possibly be overridden by a derived
class?

"pure virtual" means that a member *must* be overridden by a derived class?

"final" means that a member can not be overridden by a derived class?

And by default members are "virtual" in D.

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
8/08/2007 11:19:00 AM



More information about the Digitalmars-d mailing list