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

前端 未结 5 2154
长情又很酷
长情又很酷 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条回答
  •  遥遥无期
    2021-02-15 12:29

    [class.abstract]: "A pure virtual function need be defined only if called with, or as if with (12.4), the qualified-id syntax (5.1)."

    Your A::f is called by B::f, so there must be a single definition of A::f.

提交回复
热议问题