C++ Logo


Advanced search

Re: Conditional final class-virt-specifier

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Tue, 14 Jul 2020 20:22:50 +0300
On Tue, 14 Jul 2020 at 20:16, PaweĊ‚ Benetkiewicz via Std-Proposals
<std-proposals_at_[hidden]> wrote:
> > If you want to limit what classes can use a class as a base, make everything (esp. constructors) in the class private, make the "welcome" classes friends and ensure that they behave. That's what some of us have indeed been doing for many years in order to limit the set of classes that can inherit from a particular base, and suggestions for some more direct facility haven't come up, because that was unnecessary.
> This way you disallow instantiation of a class, not the inheritance itself.
> My proposal is about conditionally disallowing inheritance, not instantiation of a class.

..and why is that important to be able to do? If I can't construct a
base class, that seems to prevent
using it as a base class sufficiently well.

Received on 2020-07-14 12:26:18