C++ Logo


Advanced search

Subject: Re: [std-proposals] Specific Override Specifier
From: Vishal Oza (vickoza_at_[hidden])
Date: 2020-03-18 11:03:31

I am not sure in this is a good idea to put into the language as you still
have to define lock for class A. I think this would be better to define in
the core guidelines as to avoid this issue. Also if A::lock is not mark a
virtual both B::lock and C::lock are available by typecasting A as a type
of B or C.

On Tue, Mar 17, 2020 at 1:12 PM Ryan Nicholl via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> Consider:
> class A : public B, public C
> {
> virtual int lock();
> };
> what happens if both B::lock and C::lock exist as virtual functions? we
> can override them both with one function... but what if they are interfaces
> that do different things and happen to use the same name?
> Suggestion, specific override specifier:
> virtual int lock_mutex() override(int B::lock());
> virtual int lock_device() override(int C::lock());
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

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

Standard Proposals Archives on Google Groups