Recommended ways to handle final classes

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Fri Aug 16 08:11:51 PDT 2013


Hi all,

I'm writing some class-based code and so my concerns have turned to the issue of
final classes vs. inheritance.

Suppose that you want a particular class to be able to act as a base class, but
also to perform at top speed.  Is the following kind of pattern worth considering:

    class _A
    {
        // ... implementation, with virtual functions
    }

    final class A : _A
    {
        // ... don't add anything!
    }

...?  Or are there other recommended ways to handle how to get speed while still
allowing the option of inheritance?

Thanks & best wishes,

    -- Joe


More information about the Digitalmars-d-learn mailing list