C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] Conditional final class-virt-specifier
From: Ville Voutilainen (ville.voutilainen_at_[hidden])
Date: 2020-07-14 12:22:50


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.


STD-PROPOSALS list run by herb.sutter at gmail.com

Standard Proposals Archives on Google Groups