Overloading/Inheritance issue
Bill Baxter
dnewsgroup at billbaxter.com
Tue Aug 7 19:26:22 PDT 2007
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.
>
>
> Sean
So does that mean you can't do non-virtual overloads in D?
I.e. have a situation where:
x.foo()
and
(cast(Base)x).foo()
call different member functions?
If not, probably it's good riddance, but I do vaguely recall having a
use for it once in C++.
--bb
More information about the Digitalmars-d
mailing list