C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Detect non overriden function

From: organicoman <organicoman_at_[hidden]>
Date: Sat, 19 Mar 2022 19:56:56 +0400
You haven't said why you'd like that and why a pure virtual won't help you. It would be a compilation error, not a warning, though.Thiago,Qt , has a class called QIODevice, this class is the base class of many derived classes.Some of the derived class, override a couple of methods, use the base class implementation for others and are indifferent to other base class methods.As an End user, and without checking the documentation, you use a method of one of these derived classes, but you are not sure if it overrides the base implementation or not.So obviously during debugging you don't suspect that the method you are using is not overrriden, and you keep looking somewhere else for the bug, which you will never know, especially with the jungle of signals and slots feature of Qt.So if i had a compiler warning telling me, "watchout, you are using the base class implementation", the first move is to check if the base class implementation covers my derived case.There is a hack to solve this, using the "curiously recurring template paradigm",But given the information is actually available at compile time, it is better to be a compiler feature. If you don't control the code, there's nothing to be done. C++generally doesn't allow code external to a class to modify the way youinterface with that class, so I highly doubt the committee wouldintroduce a feature to do that for something like this. You can createa new class that inherits from the base class, but that would requireusers to use your class instead of the base class.Jason,I would like to have this feature to communicate to my end users that some methods in the derived class he is about to use, are actually using the default implementation of the base class.Just as a warning.More information about the code is never bad.What do you think?Sent from my Galaxy

Received on 2022-03-19 15:57:07