C++ Logo

STD-PROPOSALS

Advanced search

Subject: [std-proposals] Specific Override Specifier
From: Ryan Nicholl (rnicholl_at_[hidden])
Date: 2020-03-17 13:12:32


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 list run by herb.sutter at gmail.com

Standard Proposals Archives on Google Groups