A virtual member function is used if it is not pure?

前端 未结 5 2155
长情又很酷
长情又很酷 2021-02-15 12:03

C++03 3.2.2 ...An object or non-overloaded function is used if its name appears in a potentially-evaluated expression. A virtual member function is used

5条回答
  •  梦毁少年i
    2021-02-15 12:33

    This is related but off-topic: from the citations it seems there is a hole in the Standard alright: it should also say a pure virtual destructor is used, and, that it must be defined; at least if there exist any derived class objects which are destroyed or if a destructor of such is defined, since the derived class destructor must call the base destructor, implicitly it does so with the qualified::id syntax. The definition of such destructors is usually trivial but cannot be elided and cannot be generated.

提交回复
热议问题