Use-cases of pure virtual functions with body?

前端 未结 7 1279
心在旅途
心在旅途 2020-11-30 23:24

I recently came to know that in C++ pure virtual functions can optionally have a body.

What are the real-world use cases for such functions?

7条回答
  •  半阙折子戏
    2020-12-01 00:12

    One use case is calling the pure virtual function from the constructor or the destructor of the class.

提交回复
热议问题