Pure virtual functions in C++11

前端 未结 8 2184
太阳男子
太阳男子 2020-12-29 18:46

In C++98, the null pointer was represented by the literal 0 (or in fact any constant expression whose value was zero). In C++11, we prefer nullptr

8条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-29 19:23

    The = 0 notation for virtual functions wasn't literally "assign null" but rather a special notation which is actually deceptive: a pure virtual function can also be implemented.

    With various context keywords it would make more sense to allow abstract rather than = nullptr and have abstract be a context keyword.

提交回复
热议问题