Andrey Tarasevich said:
There's one thing that is not clear in your question. There are several
details in your posts that seem to suggest that in the real code the
base class' function is virtual. In the code sample above the function
is not virtual. Several people here missed this important fact and gave
you answers that apply to virtual functions only, and, surprisingly, you
didn't object. Can you, please, clarify whether the function you are
talking about is virtual or not?
Thanks for pointing out the key word "virtual". Actually in this question,
virtual or not is not important because my object is to prevent *specific*
function(not all functions) in base class being defined in derived class no
matter it's virtual or not as long as there is a way to do, if derived class
happened defined(we have to believe that programmers have different
understandings about a system), C++ compiler should raise an error, but
unfortunately, nobody could answer this question directly, that means there
is not this kind of feature in C++.
When I studied C++, I noticed that C++ is trying the best to offer all
possibilities to control how member function of class is handled, like
private/protect/public/virtual/static/overload/override/namingConvention
etc. This is why I am looking for if there is a feature like the one
mentioned in my question. If this feature exists, I think the code or logic
would be more clear, simple or even easier on bug control, source code
maintain.