override on non-virtual functions

后端 未结 3 955
有刺的猬
有刺的猬 2020-12-09 08:51

The C++11 FDIS it says

If a virtual function is marked with the virt-specifier override and does not override a member function of a base class, the

3条回答
  •  孤街浪徒
    2020-12-09 09:08

    Yes, the program is ill formed when override is added to any non-virtual function.

    Generally, functions with differing signatures (overloaded), are as different as functions with different names. The example given in the Spec is not meant to imply that the function name effects override. It's meant to show the common error that override is designed to prevent.

提交回复
热议问题