C++ Logo


Advanced search

Re: [std-proposals] Detect non overriden function

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Sat, 19 Mar 2022 09:40:25 -0400
On Sat, Mar 19, 2022 at 7:35 AM organicoman via Std-Proposals
<std-proposals_at_[hidden]> wrote:
> Hello,
> Is there a way to decorate a member function as non overriden, so at the call site the user will receive a compile time warning that he is using the base class implementation instead of the derived class implementation?

If your intent is to force derived classes to override a method, and
you want to give a compile error when attempting to call this function
if the derived class did not, we already have a mechanism for that:
pure virtual functions.

If that won't solve the issue, you should explain what functionality
pure virtual functions lack that you're looking for.

Received on 2022-03-19 13:40:49