How to use inheritance when interfacing with C++ classes?
Tim
tim.dlang at t-online.de
Fri Dec 10 16:42:33 UTC 2021
On Friday, 10 December 2021 at 12:46:07 UTC, rempas wrote:
> On Thursday, 9 December 2021 at 21:35:14 UTC, Tim wrote:
>> Methods, which are not virtual in C++, also have to be marked
>> final in D, because C++ and D use a different default.
>
> Is this a must or just good practices?
All virtual methods have to match exactly including order. If a
virtual method is missing or added, then calling this or a later
virtual method could call the wrong method or generate a
segmentation fault. Non-virtual methods have to be marked final
in D, but can also be removed.
More information about the Digitalmars-d-learn
mailing list